Forum Discussion

arthau1's avatar
arthau1
New Member
1 year ago
Solved

Quartiles - dynamically recalculating with slicers

Hello hello! 

 

There are a couple of topics similar to this, but none address my issue, so creating a new thread.

 

Very simple request on paper, to calculate quartiles based on value, PER year. The part I am struggling with is that it calcualtes it once, correctly, but then when I use slicers in my report, it doesn't re-calculate, but just takes those originally calculated quartile values and slots them into Q1, Q2, Q3, Q4, which creates uneven quartile distribution.

 

So far I have used PERCENTILE.INC(Main[Hourly], 0.25), with a FILTER on [Year], by using EARLIER function.

This works, up until I use any slicers in the visual later. Tried ALLSELECTED, didn't work they way I used it.
GPT & Gemini always suggest something that works except with slicers. 

 

Needs to be dynamic, so I was thinking a measure, instead of calc. column, but measures cannot be used as dimensions as far as I know.

 

Thank you!

 

 

EmployeeIDFunctionYearHourly
E1Commercial20221000.00
E2Commercial202290.00
E3Commercial202280.00
E4Finance202270.00
E5Finance202260.00
E6HR202250.00
E7HR202240.00
E8Purchasing202210.00
E9Purchasing20225.00
E1Commercial20231000.00
E2Commercial2023800.00
E3Commercial2023700.00
E4Finance2023400.00
E5Finance2023300.00
E6HR2023200.00
E7HR2023100.00
E8Purchasing2023100.00
E9Purchasing202370.00

 

  • You can create separate measures for each quartile

    Q1 Measure = 
    PERCENTILE.INC(
    FILTER(
    Main,
    Main[Year] = MAX(Main[Year])
    ),
    0.25
    )

    Q2 Measure =
    PERCENTILE.INC(
    FILTER(
    Main,
    Main[Year] = MAX(Main[Year])
    ),
    0.50
    )

    Q3 Measure =
    PERCENTILE.INC(
    FILTER(
    Main,
    Main[Year] = MAX(Main[Year])
    ),
    0.75
    )

2 Replies

  • You can create separate measures for each quartile

    Q1 Measure = 
    PERCENTILE.INC(
    FILTER(
    Main,
    Main[Year] = MAX(Main[Year])
    ),
    0.25
    )

    Q2 Measure =
    PERCENTILE.INC(
    FILTER(
    Main,
    Main[Year] = MAX(Main[Year])
    ),
    0.50
    )

    Q3 Measure =
    PERCENTILE.INC(
    FILTER(
    Main,
    Main[Year] = MAX(Main[Year])
    ),
    0.75
    )
  • sjoerdvn's avatar
    sjoerdvn
    Solution Sage

    Indeed, calculated columns will not work and you need to use measures. If you need columns or axis to display results on you will also need to create a "helper" dimension, basically a small table with hardcoded vales (Q1, Q2, etc).
    In these measure you will need to get the value from the helper dimension in the current context, and filter your result accordingly.