Question regarding MAX DAX formula concerning date table and fact table

Caze982

Board Regular
Joined
May 10, 2015
Messages
77
Hi everyone



I have a star schema model where i have some dimension tables and a fact table. The dates in the dimension date table go to the end of the year 2025. The fact table date is always to days date.



I want to calculate visits year-to-date but the formula below (v.1) does not work but v.2 do. Can anyone explain why v.2 works and v.1 does not?



YTD (v.1) =
CALCULATE ( [Visits], DATESYTD ( Dim_dato[Date] ) )


YTD (v.2) =
CALCULATE (
CALCULATE ( [Visits], DATESYTD ( Dim_dato[Date] ) ),
Dim_dato[Date] <= MAX ( 'Fact_besøg'[Date] )
)
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
if your dim[date] column is connected to fact[date] in your model, and if you are using dim[date] in your visual, not fact[date], then the first formula is correct. My guess is you are using fact[date] in your visual, which if you are, is wrong. its good practice to hide fact[date] unless there is some specific reason to keep it visible.
 
Upvote 0

Forum statistics

Threads
1,215,101
Messages
6,123,095
Members
449,095
Latest member
gwguy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top