I am a DAX-newbie. I have a measure that accumulates column Total cost, USD by column Month Year, but I want to extend it to also accumulate by column Country for use in a cumulative flow diagram.
The following is an example (unrelated data in R Shiny) of what I am trying to emulate.
I have tried the following code, but it gives error message "Too few arguments were passed to the filter function".
CumulatedSupplies2 =
CALCULATE(
SUM(Query2[Total cost, USD]),
FILTER(ALLEXCEPT(Query2,Query2[Country],Query2[Month Year]<= MAX(Query2[Month Year])))
Many thanks in advance for guidance!
Solved! Go to Solution.
Hi @CJDK ,
You missed a closing parenthesis in your measure, you can use DAX Formatter to check whether there are any syntax error in measure, calculated column or calculated table.
CumulatedSupplies2 = CALCULATE ( SUM ( Query2[Total cost, USD] ), FILTER ( ALLEXCEPT ( Query2, Query2[Country] ), Query2[Month Year] <= MAX ( Query2[Month Year] ) ) ) |
Best Regards
Hi @CJDK ,
You missed a closing parenthesis in your measure, you can use DAX Formatter to check whether there are any syntax error in measure, calculated column or calculated table.
CumulatedSupplies2 = CALCULATE ( SUM ( Query2[Total cost, USD] ), FILTER ( ALLEXCEPT ( Query2, Query2[Country] ), Query2[Month Year] <= MAX ( Query2[Month Year] ) ) ) |
Best Regards
@CJDK , Try like
CumulatedSupplies2 =
CALCULATE(
SUM(Query2[Total cost, USD]),
FILTER(Query2,Query2[Month Year]<= MAX(Query2[Month Year])),ALLEXCEPT(Query2,Query2[Country]))
or
CumulatedSupplies2 =
CALCULATE(
SUM(Query2[Total cost, USD]),
FILTER(allselected(Query2),Query2[Month Year]<= MAX(Query2[Month Year]) && Query2[Country] = max(Query2[Country])))
User | Count |
---|---|
214 | |
76 | |
72 | |
71 | |
53 |
User | Count |
---|---|
193 | |
96 | |
78 | |
76 | |
68 |