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,
Me again with a question.
I am working on a very complex power bi report doing a lot of fiscal year calculations in covering current and previous W,M,Q,Y.
Now i like to think my fiscal year, quarter solution is pretty solid. The measure syntax is pretty straightforward. But iam hitting a bit of anu issues with the totals. The standard SUM leaves the totals empty, which is not desired. Now i've done a fair amount of digging whereby the solution is to using the SUMX within the measure to solve this issue.
In general i am seeking some advice what the best approaches are. I am just not knowledgable enough on the use of SUMX, SUMMARIZE and related functions.
Here we go:
I've got this measure of calculating the Past / Prior Quarter.
Now from various sources i've learned that SUMX would solve my issue (and it does).
But using this pattern would mean all my fiscal measures require an additional SUMX measure. Is that really the best approach? I would like to see how both can be combined.
Is there a better way of approaching this? What is the best practise pattern covering these kind of measures?
Please find below a link to the power bi file.
https://1drv.ms/u/s!Ag3hOdYVKV71qkVw9go35YozMPbW?e=BYGc5n
Solved! Go to Solution.
@Mark1982 Why do you want the total to not be blank? It's a bit confusing to the end user that you've named it 'Sales Amount PQ' but the total actually provides the total Sales Amount for all time (this is due to the date context not being provided in the total row).
SUMX is a good measure to use and get in the habit of using.
If you will always provide a quarter context, or want to use the quarter associated witht the lastdate in context (since you used LASTDATE function in your measure) you could also update your measure to remove the FILTER expression:
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
The user would like to be able to view the current period vs the prior. This includes the total. Further in my model (not in the example provided) there are some variance and difference calculations. The solution provided will not result in correct calculations.
From your response i am getting that using an additional measure SUMX as wrapper is good practise. I am understanding that correctly?
@Mark1982 Yes, SUMX is good practice and better performance, so get into that habit and you'll save yourself a lot of headaches.
Does that mean you have resolved the issue with use of SUMX? If you're still looking for a solution please provide more detail on the variance, etc you omitted from your example so we can provide an accurate solution that is comprehensive, otherwise mark one of these posts as a solution or write up a summary and mark that summary as the solution so others can learn too.
SUMX is awesome in general. Probably more info than you're looking for, but SQLBI are my go to source for DAX learnings: https://www.sqlbi.com/blog/alberto/2011/10/26/sum-or-sumx-with-simple-intermediate-calculations-sumx...
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
@Mark1982 Why do you want the total to not be blank? It's a bit confusing to the end user that you've named it 'Sales Amount PQ' but the total actually provides the total Sales Amount for all time (this is due to the date context not being provided in the total row).
SUMX is a good measure to use and get in the habit of using.
If you will always provide a quarter context, or want to use the quarter associated witht the lastdate in context (since you used LASTDATE function in your measure) you could also update your measure to remove the FILTER expression:
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
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 |
---|---|
106 | |
94 | |
77 | |
65 | |
53 |
User | Count |
---|---|
145 | |
105 | |
104 | |
90 | |
63 |