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 Experts,
My source data is following
Name | CAT | Quarter | Amount |
Name1 | CAT1 | 1 | 1000 |
Name1 | CAT1 | 2 | 2000 |
Name1 | CAT1 | 3 | 3000 |
Name1 | CAT1 | 4 | 4000 |
Name1 | CAT2 | 1 | 100 |
Name1 | CAT2 | 2 | 200 |
Name1 | CAT2 | 3 | 300 |
Name1 | CAT2 | 4 | 400 |
Name2 | CAT1 | 1 | 10000 |
Name2 | CAT1 | 2 | 10000 |
Name2 | CAT1 | 3 | 10000 |
Name2 | CAT1 | 4 | 10000 |
Name2 | CAT2 | 1 | 20000 |
Name2 | CAT2 | 2 | 20000 |
Name2 | CAT2 | 3 | 20000 |
Name2 | CAT2 | 4 | 20000 |
I am trying to create a matrix visual with this data which will be filtered on Quarter #. When filtered it will show 3 values for amount
A. Current quarter value - easily achievable,
B. Yearly Total - DAX to ignore the Quarter filter and calculate the sum of amount
C. YTD Running total - DAX to respect the Quarter Filter and calculate the sum of amount for all period <=Quarter Filter
I am currently generating the following which satisfies A
How can I generate the folowing
Name | CAT | A | B | C |
Name1 | CAT1 | 3000 | 10000 | 6000 |
Name1 | CAT2 | 300 | 1000 | 600 |
Name2 | CAT1 | 10000 | 40000 | 30000 |
Name2 | CAT2 | 20000 | 80000 | 60000 |
Thank you in advance.
Solved! Go to Solution.
Hey,
I created these 3 measures:
A - Current quarter value = SUM('Table1'[Amount])
B - Yearly total = CALCULATE( [A - Current quarter value] ,ALL('Table1'[Quarter]) )
C - YTD Running Total = CALCULATE( [A - Current quarter value] ,FILTER( ALL(Table1[Quarter]) ,'Table1'[Quarter] <= MAX('Table1'[Quarter]) ) )
These measures allow me to create a matrix visual and a table visual like so:
Instead of using the quarter column as a viual level filter I created a slicer.
Even if it's not necessary today, because your data model has just one table, I recommend to read through this article: https://www.daxpatterns.com/time-patterns/ From my experience it's always a good idea to have a dedicated Calendar table, even if it seems to make things more complicated at a first glance.
Regards,
Tom
Hey,
I created these 3 measures:
A - Current quarter value = SUM('Table1'[Amount])
B - Yearly total = CALCULATE( [A - Current quarter value] ,ALL('Table1'[Quarter]) )
C - YTD Running Total = CALCULATE( [A - Current quarter value] ,FILTER( ALL(Table1[Quarter]) ,'Table1'[Quarter] <= MAX('Table1'[Quarter]) ) )
These measures allow me to create a matrix visual and a table visual like so:
Instead of using the quarter column as a viual level filter I created a slicer.
Even if it's not necessary today, because your data model has just one table, I recommend to read through this article: https://www.daxpatterns.com/time-patterns/ From my experience it's always a good idea to have a dedicated Calendar table, even if it seems to make things more complicated at a first glance.
Regards,
Tom
@TomMartensthanks a lot for your help. It was urgent and I am so greatful to you and this community. It is really awesome.
My DAX side is not as strong as M. Can you please advise if there are some resources I can follow to learn DAX structurally and pick up the basic DAX concepts.
Thanks again. I picked my brain all morning for this.
Hey @smpa01
my favorite recommendation to start learning DAX is this book:
Regards,
Tom
@smpa01 there are lot of posts on time intelligence calculations and also lot of dax functions available, first and foremost, it is best practice to have date dimension in your model (lot of post on this as well) and then all these calculations become super easy.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@parry2k thanks. Can you please post some URL for date dimension tables here if you happen to have them handy by chance.
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 |
---|---|
112 | |
79 | |
77 | |
46 | |
38 |
User | Count |
---|---|
148 | |
116 | |
65 | |
64 | |
54 |