Forum Discussion

akp's avatar
akp
Frequent Visitor
9 months ago
Solved

Slicers on Aggregated Measures

Hi, I have a table with following example Date Time Area Counts Amounts 1/1/2023 10:00 Dallas 1 23 1/2/2023 11:00 Austin 1 34 1/3/2023 12:00 Boston 1 5 1/4/2023 ...
  • DataNinja777's avatar
    9 months ago

    Hi akp ,

     

    In order to achive your required output, you can set the disconnected tables for count and amount ranges while keepoing the relationship between your fact table and the calendar table. Then, the key to solving the problem is to create a measure to put on the visual filter like below:

    Filter matches = 
    -- Get current slicer values
    VAR MinCount = MIN('Slicer_Counts'[Value])
    VAR MaxCount = MAX('Slicer_Counts'[Value])
    VAR MinAmount = MIN('Slicer_Amounts'[Value])
    VAR MaxAmount = MAX('Slicer_Amounts'[Value])
    
    -- Get current context values (which ALREADY respect the Date slicer)
    VAR ActCount = [Total Counts]
    VAR ActAmount = [Total Amounts]
    
    RETURN
    -- Check if current row's totals fall within selected disconnected ranges
    IF(
        ActCount >= MinCount && ActCount <= MaxCount &&
        ActAmount >= MinAmount && ActAmount <= MaxAmount &&
        NOT ISBLANK(ActCount),
        1,
        0
    )

    You can put the measure above to "Filter on this visual" and set Show items when the value "is" "1", and click Apply filter. 

    The resultant output is responsive to your range selection in the disconnected slicers of the amount range and count range as shown below:

    I have attached an example pbix file for your reference.

     

    Best regards,