Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi all,
I have this DAX formula to basically calculate sum of amount for months after selected date.
Hey @Andrea_Jess ,
Forecast and Amount are the same in the Total Line, as there is no active filter for year month in the total.
You can solve this using the table iterator function SUMX SUMX – DAX Guide.
Your measure then will be similar to this:
Show Future Forecast =
SUMX(
SUMMARIZE(
'<yourcalendartable>'
, '<yourcalendartable>'[year]
, '<yourcalendartable>'[month]
)
, ... // the numeric expression
)
The numeric expression might look like this:
var a = CALCULATE( SUM(Data[Amount]) )
var b = CALCULATE( MAX(Data[Month for Finacial Date]) )
var c = CALCULATE( MAX(Data[Year for Finacial Date]) )
RETURN
if (b <= SELECTEDVALUE(DimDate[MonthNum]) && c = SELECTEDVALUE(DimDate[Year]) , BLANK(), a)
The CALCULATE is necessary to transform the existing ROW context that has been created by the table iterator function SUMX into a filter context.
Hopefully, this provides what you are looking for to tackle this challenge.
Regards,
Tom
Hi Tom,
Thanks for that. That makes sense. Unfortunately, i'm still getting the same totals even with the addition of the SUMX function. This is what i'm using now. Is there something incorrect i'm doing here?
Hey @Andrea_Jess ,
please create a pbix file that contains sample data but still reflects your data model (tables, relationships between tables, calculated columns, and measures). Upload the pbix to onedrive or dropbox and share the link. If you are using Excel to create the sample data instead of the manual input method share the xlsx as well.
Please explain the expected result based on the sample data you provided.
Regards,
Tom
User | Count |
---|---|
94 | |
86 | |
78 | |
70 | |
63 |
User | Count |
---|---|
114 | |
99 | |
97 | |
65 | |
59 |