Forum Discussion

Snagalapur's avatar
Snagalapur
Icon for Helper IV rankHelper IV
1 year ago
Solved

Top 10 records in bar chart - based multiple measures

Hi All,

 

Please suggest how to filter top 10 reocrds, currently i have bar chart switching between diffrent KPI's using slicer.

In slicee i have 3 measures as shown below.

 

 

 

Thank you.

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Snagalapur,

    Could you please provide some sample data?

     

    I have made a simpe demo for your reference, please check for details.

    Here is my sample data:

    Here is how I configure the bar chart:

    Write a DAX to switch based on KPIs:

    Sales Measure = 
    SWITCH(
       TRUE(), 
       SELECTEDVALUE('Table'[Measure Selector]) = "Actual Sales",[ActualSalesM],
       SELECTEDVALUE('Table'[Measure Selector]) = "Forecast Sales",[ForecastSalesM]
    )

    Note that the ActualSalesM is the measure for selected KPIs, you need to replace it with your own measure name.

    On my side, I have two measure for KPIs, 

    ActualSalesM = SUM('Table'[Actual Sales])
    ForecastSalesM = SUM('Table'[Forecast Sales])

     

    Best Regards,
    Qi
    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

4 Replies

  • Hi, 

    Use the Top N filter in the "Filters" pane:

    1. Select the bar chart → Open Filters pane.
    2. Apply "Top N" filter on the KPI measure.
    3. Set N = 10, choose the measure, and apply filter.

    For dynamic KPI switching, ensure your measure updates based on the slicer selection.

    Thanks,

    Bhavin

  • Hi Snagalapur, Please try the below approach:

    click the bar chart to make it active.

    Then click the dropdown arrow next to field which you want to filter out under the Filters tab.

    Then click the dropdown arrow under Filter type and choose Top N.

    Then type 10 under Show items.

    Then drag the KPI/ Act v. Fcst field to to the By value area.


    If this post helps to answer your question, please consider accepting it as a solution so others can find it more quickly when they face a similar challenge.


    Proud to be a Microsoft Fabric community super user


    Let's Connect on LinkedIn


    Subscribe to my YouTube channel for Microsoft Fabric and Power BI updates.

    • Snagalapur's avatar
      Snagalapur
      Icon for Helper IV rankHelper IV

      Thank you for details,

      How to switch Top 10 based on KPI changes ie.. I have 3 measures to be sorted on.

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Snagalapur,

        Could you please provide some sample data?

         

        I have made a simpe demo for your reference, please check for details.

        Here is my sample data:

        Here is how I configure the bar chart:

        Write a DAX to switch based on KPIs:

        Sales Measure = 
        SWITCH(
           TRUE(), 
           SELECTEDVALUE('Table'[Measure Selector]) = "Actual Sales",[ActualSalesM],
           SELECTEDVALUE('Table'[Measure Selector]) = "Forecast Sales",[ForecastSalesM]
        )

        Note that the ActualSalesM is the measure for selected KPIs, you need to replace it with your own measure name.

        On my side, I have two measure for KPIs, 

        ActualSalesM = SUM('Table'[Actual Sales])
        ForecastSalesM = SUM('Table'[Forecast Sales])

         

        Best Regards,
        Qi
        Community Support Team

         

        If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
        If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!