Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi everyone,
I am stumped! I can't figure out why the two formulas below return the same result. Am I missing somethng really obvious?
ExD Month = CALCULATE(TOTALMTD(SUM('Ex-Distributor'[ExDistributor Sales]),'DateDim'[Date]))
Ex-UD AVG (Month) = CALCULATE(SUM('Ex-Distributor'[ExDistributor Sales]),DATESINPERIOD('Ex-Distributor'[Month],LASTDATE('Ex-Distributor'[Month]),-5,MONTH))/CALCULATE(DISTINCTCOUNT('Ex-Distributor'[Month]),DATESINPERIOD('Ex-Distributor'[Month],LASTDATE('Ex-Distributor'[Month]),-5,MONTH))
Thanks a lot!
Solved! Go to Solution.
@Anonymous , try somthing like this with date table
Rolling 5 = divide( CALCULATE(sum(Sales[Sales]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date]),-5,MONTH)) ,
CALCULATE(distinctCOUNT('Date'[Month Year]),DATESINPERIOD('Date'[Date],MAX('Date'[Date]),-5,MONTH), not(isblank((Sales[Sales])))))
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.
Hi @Anonymous ,
Did you have a date table , you should use date column instead of month column in formula:
Ex-UD AVG (Month) =
CALCULATE (
SUM ( 'Ex-Distributor'[ExDistributor Sales] ),
DATESINPERIOD (
'DimDate'[Date],
LASTDATE ( 'DimDate'[Date] ),
-5,
MONTH
)
)
/ CALCULATE (
DISTINCTCOUNT ( 'DimDate'[Date] ),
DATESINPERIOD (
'DimDate'[Date],
LASTDATE ( 'DimDate'[Date] ),
-5,
MONTH
)
)
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
Hi @Anonymous ,
Did you have a date table , you should use date column instead of month column in formula:
Ex-UD AVG (Month) =
CALCULATE (
SUM ( 'Ex-Distributor'[ExDistributor Sales] ),
DATESINPERIOD (
'DimDate'[Date],
LASTDATE ( 'DimDate'[Date] ),
-5,
MONTH
)
)
/ CALCULATE (
DISTINCTCOUNT ( 'DimDate'[Date] ),
DATESINPERIOD (
'DimDate'[Date],
LASTDATE ( 'DimDate'[Date] ),
-5,
MONTH
)
)
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
@Anonymous , try somthing like this with date table
Rolling 5 = divide( CALCULATE(sum(Sales[Sales]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date]),-5,MONTH)) ,
CALCULATE(distinctCOUNT('Date'[Month Year]),DATESINPERIOD('Date'[Date],MAX('Date'[Date]),-5,MONTH), not(isblank((Sales[Sales])))))
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
117 | |
104 | |
77 | |
73 | |
52 |
User | Count |
---|---|
145 | |
109 | |
109 | |
90 | |
64 |