cancel
Showing results for
Did you mean:

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a \$100 discount. Register Now

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 Rate Quartile Emp1 100% Quartile 1 Emp2 90% Quartile 2 Emp3 30% 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
Super User

@Remco1986 , refer if these can help

3 REPLIES 3
Super User

HI @Remco1986 ,

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

Thanks,

Pragati

Best Regards,

Pragati Jain

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

Proud to be a Super User!!

Super User

@Remco1986 , refer if these can help

Helper I

@amitchandak thanks, these links were very usefull.

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

 quartileName sortOrder Quartile 1 1 Quartile 2 2 Quartile 3 3 Outliers 4

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

Announcements

#### Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

#### Power BI Monthly Update - February 2024

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

#### Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

#### Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors