Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
John2
Frequent Visitor

DAX formula help needed

I have a table called patch which has computer id, patch name, compliant count with values 0,1. The table has details of various ids, the patches associated with each of them and if they are compliant or not(if they have been installed or not). 
 
I have then made a dax called compliant % with formula as below:
Compliant_ % = 
var compliant_count = sum(patch[Compliant Count])
var applicable_system_count = COUNTROWS(patch)
return
DIVIDE(compliant_count,applicable_system_count,0).
 
I have made a graph which shows every computer id and their respective compliant %.
My next task it to make a compliant% range values say, 10-25,25-30% etc and show how many ids are in those ranges. How can I do that?
 
I have tried making a dax but since the ranges are text values I am not able to make graphs. I then tried used values like 1,2,3,4 to represent ranges & got the result I needed.
 
Compliance_catergory =
IF([Compliant %] >= 0.10 && [Compliant %] <= 0.18, "10-18%",
IF([Compliant %] >= 0.045 && [Compliant %] < 0.10, "4.5-10%",
IF([Compliant %] >= 0.02 && [Compliant %] < 0.045, "2-4.5%",
IF([Compliant %] >= 0.01 && [Compliant %] < 0.02, "1-2%",
"others"
)
)
)
)
But I am not able to get the required visual I want (range values and the ids in the required range), since the dax is always going to the y-axis and not the x-axis(in bar chart) and not going in legend(in pie chart).
 
What can I do so that I get the ranges? Please Help.

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @John2 ,

The legend only accepts entity columns/calculated columns as values.
Please try new a calculated column first:

Table = 
SUMMARIZE (
    'patch',
    'patch'[computer id],
    "Compliant_%",
        VAR compliant_count =
            SUM ( patch[Compliant Count] )
        VAR applicable_system_count =
            COUNTROWS ( patch )
        RETURN
            DIVIDE ( compliant_count, applicable_system_count, 0 )
)

 and new a calculated column by use [Compliance_catergory] code:

vcgaomsft_0-1704691370053.png

Best Regards,
Gao

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!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

View solution in original post

2 REPLIES 2
John2
Frequent Visitor

It works. Thank you so much

Anonymous
Not applicable

Hi @John2 ,

The legend only accepts entity columns/calculated columns as values.
Please try new a calculated column first:

Table = 
SUMMARIZE (
    'patch',
    'patch'[computer id],
    "Compliant_%",
        VAR compliant_count =
            SUM ( patch[Compliant Count] )
        VAR applicable_system_count =
            COUNTROWS ( patch )
        RETURN
            DIVIDE ( compliant_count, applicable_system_count, 0 )
)

 and new a calculated column by use [Compliance_catergory] code:

vcgaomsft_0-1704691370053.png

Best Regards,
Gao

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!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.