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
Anonymous
Not applicable

How to get column in x axis of bar chart using measure

image.png

 

I want to create Graph 1 but my table structure is as Table 2, any measure to achieve this.

Also when table 2 is unpivoted (Table 3) then only its showing total otherwise Total is not appearing in Table 2.

 

Please help me resolve it, Thanking you in advance

1 ACCEPTED SOLUTION
v-xiaoyan-msft
Community Support
Community Support

Hi @Harsh333,

 

I'm not sure if I got your point accurately. You can create a separate measure for each category.

Measure A = CALCULATE(SUM(Test[A]),ALLEXCEPT(Test,Test[Month]))

Measure B= CALCULATE(SUM(Test[B]),ALLEXCEPT(Test,Test[Month]))

Measure C= CALCULATE(SUM(Test[C]),ALLEXCEPT(Test,Test[Month]))

Measure D= CALCULATE(SUM(Test[D]),ALLEXCEPT(Test,Test[Month]))

Measure E= CALCULATE(SUM(Test[E]),ALLEXCEPT(Test,Test[Month]))

Measure FYFC = CALCULATE(SUM(Test[FYFC]),ALLEXCEPT(Test,Test[Month]))

 

Then put your measure in the chart, you will get a result like this:

vcaitlynmstf_0-1629109357084.png

 

 

There is another, more convenient solution but it does not use measure.

Based on what you mentioned above, you can unpivot Table2. You can enter data after unpivot into Power BI Desktop as Table 3.

Then use Table 3 to create a matrix like this:

vcaitlynmstf_1-1629109357089.png

 

 

Then adjust the matrix chart to a column chart. Put category in Axis. You can see this:

vcaitlynmstf_2-1629109357094.png

 

A demo is attached for your reference.

 

Hope it helps.

 

Best Regards,

Caitlyn Yan

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
v-xiaoyan-msft
Community Support
Community Support

Hi @Harsh333,

 

I'm not sure if I got your point accurately. You can create a separate measure for each category.

Measure A = CALCULATE(SUM(Test[A]),ALLEXCEPT(Test,Test[Month]))

Measure B= CALCULATE(SUM(Test[B]),ALLEXCEPT(Test,Test[Month]))

Measure C= CALCULATE(SUM(Test[C]),ALLEXCEPT(Test,Test[Month]))

Measure D= CALCULATE(SUM(Test[D]),ALLEXCEPT(Test,Test[Month]))

Measure E= CALCULATE(SUM(Test[E]),ALLEXCEPT(Test,Test[Month]))

Measure FYFC = CALCULATE(SUM(Test[FYFC]),ALLEXCEPT(Test,Test[Month]))

 

Then put your measure in the chart, you will get a result like this:

vcaitlynmstf_0-1629109357084.png

 

 

There is another, more convenient solution but it does not use measure.

Based on what you mentioned above, you can unpivot Table2. You can enter data after unpivot into Power BI Desktop as Table 3.

Then use Table 3 to create a matrix like this:

vcaitlynmstf_1-1629109357089.png

 

 

Then adjust the matrix chart to a column chart. Put category in Axis. You can see this:

vcaitlynmstf_2-1629109357094.png

 

A demo is attached for your reference.

 

Hope it helps.

 

Best Regards,

Caitlyn Yan

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

 

amitchandak
Super User
Super User

Anonymous
Not applicable

@amitchandak 

Sorry but I think you misunderstood my problem:

I want to created above bar graph (1) if my table was structured as (2).

not bar graph with table.

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.