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 am trying to show a table where in a Matrix, the total excludes Year1, where my Total would be 4400 instead of 4900 and yet Year1 data is still there.
I used this measure, but it removed the 'Year1' cause there's no value anymore.
Solved! Go to Solution.
Hi @Anonymous
Try this measure
Measure = IF ( HASONEFILTER ( 'Table'[Year] ), SUM ( 'Table'[Amount] ), SUMX ( FILTER ( VALUES ( Table[Year] ), 'Table'[Year] <> "Year1" ), CALCULATE ( SUM ( 'Table'[Amount] ) ) ) )
Hi @Anonymous
Try this measure
Measure = IF ( HASONEFILTER ( 'Table'[Year] ), SUM ( 'Table'[Amount] ), SUMX ( FILTER ( VALUES ( Table[Year] ), 'Table'[Year] <> "Year1" ), CALCULATE ( SUM ( 'Table'[Amount] ) ) ) )
@Zubair_Muhammad It worked!! Can you explain a little for me please?
I am trying to piece together how each formula works. Individually, I kinda understand, but putting them together seems a bit confusing... Sorry..
Sure @Anonymous
The formulas like HASONEFILTER,HASONEVALUE,ISFILTERED are useful in detecting totals and specifying different calculations for them.
The total row contains all the years you have selected
Here is a very good article
https://powerpivotpro.com/2013/03/hasonevalue-vs-isfiltered-vs-hasonefilter/.
So in the if clause we apply the normal sum(sales) calculation if the YEAR row contains a single year.
In the totalrow we sum the sales of all the years (excluding an year) using an interator function SUMX
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 | |
94 | |
76 | |
62 | |
50 |
User | Count |
---|---|
147 | |
106 | |
104 | |
87 | |
61 |