Forum Discussion

ahanfouf's avatar
ahanfouf
Frequent Visitor
3 years ago
Solved

Dynamically change dimension based on Slicer value

Hello Power BI-Folks,   currently I am trying to do the following:   I have a report with a card visual. There is a tooltipp on the card that shows the average order value over time. I have selec...
  • Ritaf1983's avatar
    3 years ago

    Hi ahanfouf 

    A type of automatic selection can be achieved with field parameters and another small manipulation with Dax.

    Please follow these steps:

    1. create  field parameters for months /years

    2. create a measure for "automation"

    Slicer_sel_falg =
    VAR Numyears =
        DISTINCTCOUNT ( 'Data Table'[Year] )
    VAR CurrentDateField =
        MIN ( 'Date axis'[Date axis] )
    RETURN
        INT (
            OR (
                AND ( Numyears = 1, CurrentDateField = "Start of Month" ),
                AND ( Numyears > 1, CurrentDateField = "Year" )
            )
        )

    3. filter put field parameter as axis X and filter by this flag :

    *Works perfectly as a tooltip too.

    To follow my steps, here's a link to my file with an example:Link 

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly