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,
I'm a new user of Power Bi and i have a strange problem with a data filter applied to a measure that calculate a cumulative (monthly/year etc). My architecture is: SSAS in SQL Server 2012 sp4 and Power Bi as frontend.
In SSAS I've created a formula like this:
Cumulative Previous Year:=CALCULATE (
SUM([TOTAL VOLUME]) ;
FILTER (
ALLSELECTED ('FACT TABLE');
'CALENDAR TABLE'[YEAR]
= (YEAR( MAX('FACT TABLE'[DAY]))-1)&&'CALENDAR TABLE'[MONTH]<=(MONTH(MAX('FACT TABLE'[DAY])))&&'CALENDAR TABLE'[DAY]<=DAY(MAX('FACT TABLE'[DAY]))
)
)
This formula work as espected in Excel but give an empty result in Power Bi when for example a year is selected from a data filter.
What am I doing wrong?
Thanks
Solved! Go to Solution.
Ok found a solution for my problem
Using a formula like this:
Cumulative Previous Year:=CALCULATE (
SUM([TOTAL VOLUME]) ;
FILTER (
ALL ('CALENDAR TABLE');
'CALENDAR TABLE'[YEAR]
= (YEAR( MAX('FACT TABLE'[DAY]))-1)&&'CALENDAR TABLE'[MONTH]<=(MONTH(MAX('FACT TABLE'[DAY])))&&'CALENDAR TABLE'[DAY]<=DAY(MAX('FACT TABLE'[DAY]))
);ALL('FACT TABLE'[DAY])
)
Now everything work as espected 😉
Regards
Hi @Kyuss82 ,
Can you please put some screenshots from Power BI on what result this DAX expressions is giving? The expression looks right to me.
Thanks,
Pragati
Hi @Pragati11 ,
Thanks for your reply.
Here's the report in Power Bi without a filter
Here's using the filter
The same model using Excel
Thanks
Hi @Kyuss82 ,
Try modifying your dax as follows:
Cumulative Previous Year:=CALCULATE (
SUM([TOTAL VOLUME]) ;
FILTER (
ALLSELECTED ('FACT TABLE');
'CALENDAR TABLE'[YEAR] = (YEAR( MAX('FACT TABLE'[DAY]))-1)&&'CALENDAR TABLE'[MONTH]<=(MONTH(MAX('FACT TABLE'[DAY]))) && ('CALENDAR TABLE'[DAY]<=DAY(MAX('FACT TABLE'[DAY])))
)
)
Just added 2 brackets in your DAX.
If this helps and resolves the issue, appreciate a Kudos and mark it as a Solution! 🙂
Thanks,
Pragati
Thank you for your prompt reply @Pragati11 !
Unfortunately i've got the same result 😞
I'm starting to think that the problem is SSAS 2012 that maybe is too old to work correctly with Power BI...
Ok found a solution for my problem
Using a formula like this:
Cumulative Previous Year:=CALCULATE (
SUM([TOTAL VOLUME]) ;
FILTER (
ALL ('CALENDAR TABLE');
'CALENDAR TABLE'[YEAR]
= (YEAR( MAX('FACT TABLE'[DAY]))-1)&&'CALENDAR TABLE'[MONTH]<=(MONTH(MAX('FACT TABLE'[DAY])))&&'CALENDAR TABLE'[DAY]<=DAY(MAX('FACT TABLE'[DAY]))
);ALL('FACT TABLE'[DAY])
)
Now everything work as espected 😉
Regards
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 |
---|---|
107 | |
106 | |
87 | |
73 | |
66 |
User | Count |
---|---|
124 | |
113 | |
98 | |
81 | |
72 |