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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
homa-abedinzade
New Member

how to create count measure from measure which is text

i have two measure that once  return a  decimal number for each customer, 

_grade=ROUND( ([NormAmount]*0.5 )+ ([Ratio Multo2Mono]*0.25)+ ([NormrecencyMonth]*0.125)+ ([NormMaxMonth]*0.125),2)
and other one create from _grade
var x04= ROUND(CALCULATE([CountCustomerBuy]*0.04, ALL(Dimcustomer)),0)
var x25= ROUND(CALCULATE([CountCustomerBuy]*0.25 , ALL(Dimcustomer)),0)
var x5= ROUND(CALCULATE([CountCustomerBuy]*0.5, ALL(Dimcustomer)),0)

var _RANK =
RANK (
    DENSE,
    ALLSELECTED ( Dimcustomer[namecustomer] ),
    ORDERBY ( [GradeNumber], DESC, Dimcustomer[namecustomer], ASC )
)
return
if(_RANK<=x04 , "pl",IF(_RANK <=x25 && _RANK>=x04, "GO", if(_RANK>=x5&& _RANK<=x25 , "SI","BR")))
 
now i want drow a pie chart that "pl,GO,SI,BR"  in column and count that is value 
please help to create that. thanks
1 REPLY 1
123abc
Community Champion
Community Champion

Create a New Measure for Count: First, you need to create a new measure that counts the occurrences of "pl", "GO", "SI", and "BR". You can use the COUNTROWS function along with FILTER to count rows based on your _RANK measure.

Here's how you can do it:

 

CountMeasure =
VAR SelectedRanks =
FILTER ( ALLSELECTED ( 'Dimcustomer' ), [YourMeasure] <> BLANK () )
RETURN
COUNTROWS ( SelectedRanks )

 

  1. Replace [YourMeasure] with your actual measure that generates "pl", "GO", "SI", and "BR".

  2. Create the Pie Chart: Now, you can create a pie chart using the newly created measure.

    • Drag the column containing your categories ("pl", "GO", "SI", "BR") to the Legend section of the chart.
    • Drag the CountMeasure you created to the Values section of the chart.
  3. Format the Chart: You can format the chart as per your preference, such as adding data labels to show the count values, adjusting colors, etc., using the visualization tools available in your reporting tool or Power BI.

With these steps, you should be able to create a pie chart that displays the count of "pl", "GO", "SI", and "BR" categories based on your DAX measures. Make sure to adjust the measure names and column names according to your actual data model.

 
 
 
 

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

 

In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.