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
Hello:
My formula is not calculating the right number:
1) As you can see, when I use the formula, for the first row (in red) its gives me the answer as 100%
2) I am supposed to divide the "Red row total" by "Grand total"
3) For example if the row total (red row) is $10,000, its supposed to calculate $10,000/$100,000 = 10%
4) But its not doing that. Its probably doing $10,000/$10,000 = 100%
5) But the 24.16% is correct. It did that calculation correctly.
What am I doing wrong here?
Thanks,
Sam
Solved! Go to Solution.
Hi @samnaw easy way to debug Dax Calculations is to try smaller chunks of DAX codes and see if the calculations is working fine or not and fix the bit which is wrong.
In your case, what i think is you are SUM (Sales) with Filter for year 2021 and instead of using another Filter clause can you try suing && as you are filtering data from same table (Sales)
Something like
SalesMEASURE =
CALCULATE (
SUM ( SALES[Sales_CY] ),
FILTER ( 'SALES', SALES[Sales_CY]= "2021" && SALES[_flag] ="CARD")
)
/
CALCULATE (
SUM ( SALES[Sales_CY] ),
FILTER ( 'SALES', SALES[Sales_CY]= "2021")
)
Hope this helps.
Cheers,
-Namish B
Hi @samnaw easy way to debug Dax Calculations is to try smaller chunks of DAX codes and see if the calculations is working fine or not and fix the bit which is wrong.
In your case, what i think is you are SUM (Sales) with Filter for year 2021 and instead of using another Filter clause can you try suing && as you are filtering data from same table (Sales)
Something like
SalesMEASURE =
CALCULATE (
SUM ( SALES[Sales_CY] ),
FILTER ( 'SALES', SALES[Sales_CY]= "2021" && SALES[_flag] ="CARD")
)
/
CALCULATE (
SUM ( SALES[Sales_CY] ),
FILTER ( 'SALES', SALES[Sales_CY]= "2021")
)
Hope this helps.
Cheers,
-Namish B
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.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
114 | |
79 | |
78 | |
47 | |
39 |
User | Count |
---|---|
147 | |
115 | |
65 | |
64 | |
53 |