Posts

Showing posts with the label CUSTOM

Check If a Visual Is Being Filtered

Create a table to use as a filter: Indicators = DATATABLE( "IndicatorName", STRING, "IndicatorValue", INTEGER, { { "IsSystemTotal", 1 } }) Create a measure to check if a visual is being filtered: _Is System Total = ISFILTERED('Indicators'[IndicatorName]) This can be used as an "indicator". Add the following filter to the visual: Indicators[IndicatorName] is IsSystemTotal This will cause the _Is System Total measure to return TRUE.

CUSTOM Rollup with a Hierarchy

We had a scenario where the user want to see average on the DETAIL rows and the SUM of the averages on the TOTAL row in a matrix. The  'Calendar'[Full Date] column was on the rows and it was the lowest level of the hierarchy which include week, month, etc. The  'Calendar'[Full Date] column represents a single day. HASONEVALUE will return TRUE for a single day and FALSE otherwise. When FALSE, use SUMX to iterate over the days and calculate the SUM of the averages. Here is the measure: 'Financial Summary'[Average Sales (With Rollup)] =  VAR AverageSales =       AVERAGEX ( 'Financial Summary' , 'Financial Summary'[TransactionAmount] ) RETURN      IF (          HASONEVALUE ( 'Calendar'[Full Date] ) ,          AverageSales,           SUMX ( VALUES ( 'Calendar'[Full Date] ) , AverageSales...

Custom Rollup Without a Hierarchy

We had a scenario where the user want to see average at the ROW level and the SUM of the averages at the TOTAL level in a matrix. There was no hierarchy on the rows. The rows have the  'Financial Summary Line Type'[Digital Description] column. Here's the brute force solution: LineType gets the value of  the  'Financial Summary Line Type'[Digital Description] column for the DETAIL rows and BLANK() for the TOTAL row. Average Sales (Digital Rollup) = VAR LineType = SELECTEDVALUE('Financial Summary Line Type'[Digital Description], BLANK()) VAR AllDigitalLineTypes = ADDCOLUMNS( CALCULATETABLE( VALUES('Financial Summary Line Type'[Digital Description]), 'Financial Summary Line Type'[Digital] = 1 ), "@AverageSales", CALCULATE(DIVIDE(SUM('Financial Summary'[TransactionAmount]), COUNTROWS('Calendar'))) ) RETURN IF ( NOT ISB...