The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
I have the following calculation in my Power BI shared dataset ‘klima’:
% change MoM/QoQ emissions intensity = var cm = [Carbon intensity scope 1 and 2 tCO2 emissions per MNOK loan total] var pm = CALCULATE([Carbon intensity scope 1 and 2 tCO2 emissions per MNOK loan total], DATEADD(DimDato[Date],-1,MONTH)) var ck = [Carbon intensity scope 1 and 2 tCO2 emissions per MNOK loan total] var pk = CALCULATE([Carbon intensity scope 1 and 2 tCO2 emissions per MNOK loan total], DATEADD(DimDato[Date],-1,QUARTER)) var change_mom = cm - pm var change_qoq = ck - pk var percent_change_mom = DIVIDE(change_mom, pm) var percent_change_qoq = DIVIDE(change_qoq, pk) return if(ISINSCOPE(DimDato[YearQuarter]), percent_change_qoq, if(ISINSCOPE(DimDato[YearMonth]), percent_change_mom, percent_change_qoq))
This calculation works perfectly. Now I’ve created a new Power BI report in Power BI desktop where I want to use this formula. However, the formula doesn’t work in the new report, I’m getting a blank result. It seems that it doesn’t understand the time intelligence of DATEADD, even though I have a relationship with the column DimDato[Date] (from a different table, not the shared dataset). How can I solve this?
One solution is to add the exact same measure to my new Power BI report, then I get the expected result. But that means I’ll have to do this for multiple formulas. This not only takes time but also adds more management overhead.
I hope someone can help me with this issue
Solved! Go to Solution.
@Nina88 , Please make sure there date is selected in the slicer/filter or there is a column from the date tab in the context. Otherwise, dateadd will not be able to find the correct month.
Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5b...
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 @Nina88 ,
@amitchandak Thanks for your concern about this case!
And @Nina88 , I see that the DAX you provided uses many variables such as cm, ck, pk and the like, which is a good habit to get into. You could try returning these variables that you have defined, see which one returns a problematic result, and then modify that variable to try to fix the problem.
Best Regards,
Dino Tao
@Nina88 , Please make sure there date is selected in the slicer/filter or there is a column from the date tab in the context. Otherwise, dateadd will not be able to find the correct month.
Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5b...
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.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
108 | |
77 | |
71 | |
48 | |
41 |
User | Count |
---|---|
137 | |
108 | |
69 | |
64 | |
58 |