Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago

Need Slicer Based on Percentage using Measure

Hi 

 

I had created a table with Difference and Percentage using Measures

 

I wanted to have slicer with the classifications based on the values from the dax but the outcome proved different as shown from screenshot 2.

 

Every line items are duplicated and I'd got numerous instead of single classifications

 

Any help will be appreciated

 

Thanks...tksnota...

 

Classification05 =
IF(Append_WIP[Percentage04] = 0 && Append_WIP[Percentage04] < 0.4, BLANK(),
IF(Append_WIP[Percentage04] > 0.4 && Append_WIP[Percentage04] < 0.55, "Attention Needed",
IF(Append_WIP[Percentage04] > 0.55 && Append_WIP[Percentage04] < 0.65, "Monitor The Account",
IF(Append_WIP[Percentage04] > 0.65 && Append_WIP[Percentage04] < 1, "Action Needed",
IF(Append_WIP[Percentage04] > 1, "Value > 100%"
)))))

 

 

 

3 Replies

  • Hi Anonymous -you should use a calculated column instead of a measure for your classifications

    replace with following calculated column 

    Classification05 =
    IF(Append_WIP[Percentage04] = 0 || Append_WIP[Percentage04] < 0.4, BLANK(),
    IF(Append_WIP[Percentage04] >= 0.4 && Append_WIP[Percentage04] < 0.55, "Attention Needed",
    IF(Append_WIP[Percentage04] >= 0.55 && Append_WIP[Percentage04] < 0.65, "Monitor The Account",
    IF(Append_WIP[Percentage04] >= 0.65 && Append_WIP[Percentage04] <= 1, "Action Needed",
    IF(Append_WIP[Percentage04] > 1, "Value > 100%"
    )))))

     

    the above logic resolves by making them suitable for use in slicers. 

     

    I hope this works. 

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi,

       

      I used the 2 Codes and both had the same results.

       

      Screenshot 1 should only showed  Action Needed but it also contained Attention Needed plus blank.

       

       

      Screenshot 2: How can I put a comment for Infinity "No PO With Cost" and NaAn "No PO, No Cost"

       

      Screenshot 3 should only showed "Attention Needed" but also produced blanks

       

       

      Thanks...tksnota...

  • Hi Anonymous 

    Slicers in Power BI can only be based on columns, not measures. Since your classification logic is written as a measure, it cannot be directly used in a slicer, causing the issue you're seeing.

    Solutions:

    If the Classifications Are Static:
    Use a calculated column with your classification logic:

    DAX
    Copy code
    ClassificationColumn =
    IF(Append_WIP[Percentage04] = 0 || Append_WIP[Percentage04] < 0.4, BLANK(),
    IF(Append_WIP[Percentage04] > 0.4 && Append_WIP[Percentage04] < 0.55, "Attention Needed",
    IF(Append_WIP[Percentage04] > 0.55 && Append_WIP[Percentage04] < 0.65, "Monitor The Account",
    IF(Append_WIP[Percentage04] > 0.65 && Append_WIP[Percentage04] < 1, "Action Needed",
    IF(Append_WIP[Percentage04] > 1, "Value > 100%"
    )))))
    Use this column in your slicer.

    If the Classifications Are Dynamic:
    When the logic is based on measures and needs to be dynamic, you’ll need to create a table with names and ranges (e.g., Min %, Max %, Classification). This table will serve as the base for segmentation. Check out this video explaining how to implement dynamic segmentation in Power BI.

    https://www.youtube.com/watch?v=FDa0I3J3h-c

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