Forum Discussion

atr1's avatar
atr1
Regular Visitor
1 year ago
Solved

Add individual analysis to each small multiple visual

  Hi I have data from a single dataset that I visualised using the clustered column chart as you see above, I am using the year of each data point to split it up in the visuals by adding it to...
  • DataNinja777's avatar
    1 year ago

    Hi atr1 ,

     

    To ensure that the Min, Max, and Average lines in your Power BI small multiples reflect values specific to each year, you need to create DAX measures that dynamically calculate within the filter context of each visual. By default, Power BI may calculate these statistics across the entire dataset unless you explicitly define the logic to respect the context introduced by small multiples.

    Use the following DAX measures to calculate the average, maximum, and minimum counts of unique IDs per day within each year. These measures iterate over each day of the year within the current year context and compute the desired statistics accordingly.

    AveragePerYear = 
    AVERAGEX(
        VALUES('YourTable'[Day of Year]),
        CALCULATE(COUNTROWS(VALUES('YourTable'[Unique ID])))
    )
    
    MaxPerYear = 
    MAXX(
        VALUES('YourTable'[Day of Year]),
        CALCULATE(COUNTROWS(VALUES('YourTable'[Unique ID])))
    )
    
    MinPerYear = 
    MINX(
        VALUES('YourTable'[Day of Year]),
        CALCULATE(COUNTROWS(VALUES('YourTable'[Unique ID])))
    )
    

    Replace 'YourTable', 'Day of Year', and 'Unique ID' with the actual names used in your model. Once these measures are created, go to the Analytics pane for your clustered column chart and add constant lines using these measures. Power BI will automatically respect the year context introduced by the small multiples, so each visual will show lines based only on the data for that specific year.

     

    Best regards,