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 three data tables: Budget, YTD, Calendar. I've made a relationship between budget and calendar by year, and same relationship from calendar and YTD by year.
I want to create a column chart where each month is summed and it changes based on a year splicer.
I've tried many different ways but I can't seem to get the months to sum with their respective amounts, each month just gives me the annual total. Here's my last dax, its the same for YTD"
What am I doing wrong?
Solved! Go to Solution.
Hi @NikkiG12 ,
I create a table as you mentioned.
It seems like the issue might be with the ALLEXCEPT function in your DAX formula. ALLEXCEPT retains all filters for the specified columns, but it removes filters from all other columns in the table. If you are getting the annual total for each month, it’s likely because the filter on the months is being removed, and thus the calculation is summing over the entire year.
I think you can use FILTER function to keep the context of the current month when calculating the total.
Here is the adjusted DAX code.
Total_Budget =
CALCULATE(
SUM('Budget'[Budget]),
FILTER(
ALL('CalendarTable'[Month_Name]),
'CalendarTable'[Month_Name] = MAX('CalendarTable'[Year])
)
)
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @NikkiG12 ,
I create a table as you mentioned.
It seems like the issue might be with the ALLEXCEPT function in your DAX formula. ALLEXCEPT retains all filters for the specified columns, but it removes filters from all other columns in the table. If you are getting the annual total for each month, it’s likely because the filter on the months is being removed, and thus the calculation is summing over the entire year.
I think you can use FILTER function to keep the context of the current month when calculating the total.
Here is the adjusted DAX code.
Total_Budget =
CALCULATE(
SUM('Budget'[Budget]),
FILTER(
ALL('CalendarTable'[Month_Name]),
'CalendarTable'[Month_Name] = MAX('CalendarTable'[Year])
)
)
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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 |
---|---|
22 | |
20 | |
19 | |
18 | |
13 |
User | Count |
---|---|
41 | |
39 | |
24 | |
22 | |
20 |