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
aileenkaz
Frequent Visitor

Chart from multiple measures

Hi,

I have a data table with six columns:

Q4_1, Q4_2, Q4_3, Q4_4, Q4_5, Q4_6

each of them containing values 1-4.

Client wants to see the Top2box (3&4) values for the whole Q4 question in one graph. I have calculated the Top2Box values for all of them and saved them in measures. They should be shown in one chart as in example below.

The problematic part is that I cannot save those measures into a new table (which would be easily shown in the chart), because the values are changing when data table is filtered.

 

Is there any way how to put six distinct measures into a chart like this?

aileenkaz_0-1633078245912.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @aileenkaz ,

 

I have built a data sample:

Eyelyn9_0-1633414508412.png

 

And to avoid making changes to the dataset, I'd create a calculated table for Axis:

For axis = {"Q4_1", "Q4_2", "Q4_3", "Q4_4", "Q4_5", "Q4_6"}

Eyelyn9_1-1633414574648.png

Then create the measure:

Q4_x_top2box = 
var _count1=CALCULATE(COUNTROWS('DATA'),FILTER('DATA',[Q4_1] in {3,4}))
var _count2=CALCULATE(COUNTROWS('DATA'),FILTER('DATA',[Q4_2] in {3,4}))
var _count3=CALCULATE(COUNTROWS('DATA'),FILTER('DATA',[Q4_3] in {3,4}))
var _count4=CALCULATE(COUNTROWS('DATA'),FILTER('DATA',[Q4_4] in {3,4}))
var _count5=CALCULATE(COUNTROWS('DATA'),FILTER('DATA',[Q4_5] in {3,4}))
var _count6=CALCULATE(COUNTROWS('DATA'),FILTER('DATA',[Q4_6] in {3,4}))
var _switch=SWITCH(MAX('For axis'[Value]),"Q4_1",_count1,"Q4_2",_count2,"Q4_3",_count3,"Q4_4",_count4,"Q4_5",_count5,"Q4_6",_count6)
return 
 DIVIDE(_switch,COUNTROWS('DATA')+0)

Below is the output:

Eyelyn9_2-1633414658208.png

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @aileenkaz ,

 

I have built a data sample:

Eyelyn9_0-1633414508412.png

 

And to avoid making changes to the dataset, I'd create a calculated table for Axis:

For axis = {"Q4_1", "Q4_2", "Q4_3", "Q4_4", "Q4_5", "Q4_6"}

Eyelyn9_1-1633414574648.png

Then create the measure:

Q4_x_top2box = 
var _count1=CALCULATE(COUNTROWS('DATA'),FILTER('DATA',[Q4_1] in {3,4}))
var _count2=CALCULATE(COUNTROWS('DATA'),FILTER('DATA',[Q4_2] in {3,4}))
var _count3=CALCULATE(COUNTROWS('DATA'),FILTER('DATA',[Q4_3] in {3,4}))
var _count4=CALCULATE(COUNTROWS('DATA'),FILTER('DATA',[Q4_4] in {3,4}))
var _count5=CALCULATE(COUNTROWS('DATA'),FILTER('DATA',[Q4_5] in {3,4}))
var _count6=CALCULATE(COUNTROWS('DATA'),FILTER('DATA',[Q4_6] in {3,4}))
var _switch=SWITCH(MAX('For axis'[Value]),"Q4_1",_count1,"Q4_2",_count2,"Q4_3",_count3,"Q4_4",_count4,"Q4_5",_count5,"Q4_6",_count6)
return 
 DIVIDE(_switch,COUNTROWS('DATA')+0)

Below is the output:

Eyelyn9_2-1633414658208.png

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

PhilipTreacy
Super User
Super User

Hi @aileenkaz 

I'm confused.  You say you have 6 columns containing values 1 to 4.  But your chart shows 5 values and multiple categories.  How does that relate to your data?  What does your actual data look like, can you share please.

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Hi, sorry, the chart was only an example sent by client.

 

I cannot send you data because of confidentiality, but what I have is:

  • 6 columns containing values 1 to 4
  • a measure (with value 0 to 100) calculated for each column x with this formula:
Q4_x_top2box = DIVIDE((COUNTROWS(FILTER(ALLSELECTED('DATA'),[Q4_x] = 3))+(COUNTROWS(FILTER(ALLSELECTED('DATA'),[Q4_x] = 4)))),COUNTROWS('DATA'),0)
 
What I want to do is to create this kind of chart, where the blue line will be consisting of the measures (Top2box values):

aileenkaz_0-1633083184806.png

 

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.