Greg_Deckler's avatar
Greg_Deckler
Community Champion
3 years ago

Better Filtered Value

Continuing with exploring alternatives to Power BI's default quick measures that don't involve the CALCULATE function, such as Better Running TotalBetter Average per Category, and Better Weighted Average per Category, this one is for Better Filtered Value. 

 

Power BI's Filtered Value returns something like this:

Value for February, March, June, or September = 
CALCULATE(
	SUM('Table'[Value]),
	'Table'[Month] IN { "February", "March", "June", "September" },
	ALL('Table'[MonthSort])
)

Much of this calculation is unnecessary, like the ALL statement that introduced itself by magic because I had a Sort By column on my Month column. A potentially better way that is more intuitive uses an X aggregator like so:

Better Filtered Value 2 = 
    VAR __Table = FILTER('Table', [Month] IN { "February", "March", "June", "September" })
RETURN
    SUMX(__Table,[Value])

Watch the video!

No RepliesBe the first to reply