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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Remco1986
Helper I
Helper I

Using Measure in chart axis, or make column instead of measure

Hi all,

after finding some great info on this forum, here's my first topic. My first part of this problem succeeded because of other topics I found, but I'm now running into an issue that I can not solve.

 

My data-set consists of a table with employees and their coaching data. Based on several columns, I have added a measure to calculate the 'Pass Rate'.

 

I have created a measure that will calculate the percentiles for 25, 50 and 75, and then returns a text for whatever wuartile their pass rate falls in:

 

Quartile = 
    var p25 = PERCENTILEX.INC(SUMMARIZE(ALLSELECTED(myTable,[Employee Name],"Pass Rate",[(%) Pass Rate]),[Pass Rate],0.25)
    var p50 = PERCENTILEX.INC(SUMMARIZE(ALLSELECTED(myTable),[Employee Name],"Pass Rate",[(%) Pass Rate]),[Pass Rate],0.5)
    var p75 = PERCENTILEX.INC(SUMMARIZE(ALLSELECTED(myTable),[Employee Name],"Pass Rate",[(%) Pass Rate]),[Pass Rate],0.75)
    return IF([(%) Pass Rate]>=p75,"Quartile 1",IF([(%) Pass Rate]>=p50,"Quartile 2",IF([(%) Pass Rate]>=p25,"Quartile 3","Outliers")))

 

 

This was a personal break-through after several nights of reading and trying. I now have a nice table like:

Employee Name(%) Pass RateQuartile
Emp1100%Quartile 1
Emp290%Quartile 2
Emp330%Outliers

 

Next step is to create a small graph with the count of employees per Quartile, however. I can not use my Quartile measure in the Axis part of the graph. I tried to use the same calculation but now as a Column instead of a measure, this results in the graph only displaying 'Quartile 2', probably because it's not yet grouped by Employee Name?

 

I also tried to create a column like so:

 

Quartile_text = switch([QuartileNumber],1,"1",2,"2",3,"3",4,"4")

 

 but this also returns only "2"

 

What would be the approach to get a 'Quartile Text' column/measure that I can use in a graph Axis, that shows all Quartiles that are also in the 'Employee Table'?

1 ACCEPTED SOLUTION
3 REPLIES 3
Pragati11
Super User
Super User

HI @Remco1986 ,

 

Here is a very nice article on how you can use a measure as an axis:

https://radacad.com/dax-measure-in-the-axis-of-the-power-bi-report

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

@amitchandak thanks, these links were very usefull.

 

I have now made a table (called 'quartileMap' with the Quartile texts and the sort-order:

quartileNamesortOrder
Quartile 11
Quartile 22
Quartile 33
Outliers4

 

Next, I created a measure:

 

 

Test = 
    SWITCH(SELECTEDVALUE(quartileMap[quartileName]),
        "Quartile 1",   COUNTROWS(filter(SUMMARIZE(ALLSELECTED(myTable),[Employee Name],"Quartile",[Quartile]),[Quartile]="Quartile 1")),
        "Quartile 2",   COUNTROWS(filter(SUMMARIZE(ALLSELECTED(myTable),[Employee Name],"Quartile",[Quartile]),[Quartile]="Quartile 2")),
        "Quartile 3",   COUNTROWS(filter(SUMMARIZE(ALLSELECTED(myTable),[Employee Name],"Quartile",[Quartile]),[Quartile]="Quartile 3")),
        "Outliers",     COUNTROWS(filter(SUMMARIZE(ALLSELECTED(myTable),[Employee Name],"Quartile",[Quartile]),[Quartile]="Outliers"))
    )

 

 

 

I can now create a bar graph with the quartileName from the quartileMap table in the Axis, and the Test measure as values.

 

Only thing is that the Quartile axis is not sorting by sortOrder, but alphabetically, causing Outliers to appear before Quartile 1, 2, 3. Instead of after Quartile 1, 2, 3. Not sure what the sortOrder does in this table. Never mind this last part, I had to select the quartileName column and sort it by sortOrder

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors