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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Mannai
Helper I
Helper I

Adding Axe category to measure

hello everyone 

 

Mannai_0-1652871748470.png

 

under this photo you can see that i calculated each of these bar columns with a measure but i want to show the visual like this : 

Mannai_1-1652871805380.png


is there a possible way to do it by adding category to the measures?

1 ACCEPTED SOLUTION
Shishir22
Solution Sage
Solution Sage

Hello @Mannai ,

 

I am assuming you have three measures as Femmes, Hommes and Key People.
Please follow below steps-

 

Step 1.

Create a table with name MeasureTable and column "MeasrureName" having three rows- Femmes, Hommes and Key People. 

Shishir22_0-1652876157223.png

 

 

Step 2- Create Measure as-

Measure = 
VAR A = SELECTEDVALUE(MeasureTable[MeasureName])
Return
SWITCH(A,"Femmes",[Femmes],
        "Hommes",[Hommes],
        "Key People",[Key People])

 

Step 3- In bar chart in axis show MeasureName column from the table created and use above measure in values.

 

Shishir22_1-1652876255656.png

 

Please mark it as answer if it resolves your issue. Kudos are also appreciated.

 

Cheers,
Shishir

View solution in original post

3 REPLIES 3
Shishir22
Solution Sage
Solution Sage

Hello @Mannai ,

 

I am assuming you have three measures as Femmes, Hommes and Key People.
Please follow below steps-

 

Step 1.

Create a table with name MeasureTable and column "MeasrureName" having three rows- Femmes, Hommes and Key People. 

Shishir22_0-1652876157223.png

 

 

Step 2- Create Measure as-

Measure = 
VAR A = SELECTEDVALUE(MeasureTable[MeasureName])
Return
SWITCH(A,"Femmes",[Femmes],
        "Hommes",[Hommes],
        "Key People",[Key People])

 

Step 3- In bar chart in axis show MeasureName column from the table created and use above measure in values.

 

Shishir22_1-1652876255656.png

 

Please mark it as answer if it resolves your issue. Kudos are also appreciated.

 

Cheers,
Shishir
NickolajJessen
Solution Sage
Solution Sage

I would probably try using the axis, as @ribisht17 suggested

I'm guessing the reason you're using measures is to aggregate multiple categories into the "main" categories: Homme, Femme, Key people. 

What i would do is go and create a Calculated Column, that does this aggregation and use this new colum on the axis

ribisht17
Super User
Super User

@Mannai 

 

Please check the available options here

 

You should have that category at the Axis

NOTE: >>> (From the link below)

"No of spaces" or "GROUPs of VALUES" depend on the number of DISTINCT categories you have in your X-Axis Field

 

I think without X-Axis you won't be able to give space between bars

Need to increase gaps between bars - Microsoft Power BI Community

 

Regards,

Ritesh

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.