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.
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])))
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 |
---|---|
106 | |
93 | |
75 | |
62 | |
50 |
User | Count |
---|---|
146 | |
109 | |
106 | |
88 | |
61 |