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
Seanan
Solution Supplier
Solution Supplier

Clustered bar chart with one static bar and one responsive bar

Hi all,

I have a clustered bar chart that looks like this:

PBIDesktop_wcJoKTVvmf.png

 

 

 

 

I also have some on-screen slicers that filter down characteristics such as: Gender, Ethnicity, etc.

There are 2 tables that I am getting the data from, LearnerTable and SurveyTable, which have a relationship using the Keycode column that is in both tables.

In the example image above, I have a simple measure that counts the survey keycodes. However, for the all learners bar in the chart I need this to be static so that it will not be affected when selecting the on-screen filters.

Would anyone be able to help me with this?

1 ACCEPTED SOLUTION
Seanan
Solution Supplier
Solution Supplier

I managed to find a solution using the following code:

All Learners = CALCULATE(COUNT('LA_LSSurvey'[Keycode]),ALLEXCEPT(LA_LSSurvey,LA_LSSurvey[SurveyAnswerEnglish]))

 

Thanks for trying to help @amitchandak

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Seanan , You can have measure like

 

Calculate([Your Measure], filter(all(Table], Table[learners] = Max(Table[learners] ) ) )

 

 

Assumes the axis column is learners

Hi @amitchandak 

Thanks for your swift response.

So I've tried your measure with both tables:

All Learners = CALCULATE('MeasuresTable'[Selected Learners], FILTER(ALL('LA_LSLearners'),'LA_LSLearners'[Keycode] = MAX('LA_LSLearners'[Keycode])))
All Learners = CALCULATE('MeasuresTable'[Selected Learners], FILTER(ALL('LA_LSSurvey'),'LA_LSSurvey'[Keycode] = MAX('LA_LSSurvey'[Keycode])))

The first measure is returning no results and the second measure is only returning 1 result (No filters have been selected).

My axis are as follows:

PBIDesktop_h1JcFp18Q0.png 

 

 

 

 

 

 

An example of the outcome I'm looking for is:

All learners bar = 21 for Happy, 2 for Unhappy

Selected learners bar (with filters applied) = 12 for Happy, 1 for Unhappy. 

 

I hope this helps clear anything up.

 

Seanan
Solution Supplier
Solution Supplier

I managed to find a solution using the following code:

All Learners = CALCULATE(COUNT('LA_LSSurvey'[Keycode]),ALLEXCEPT(LA_LSSurvey,LA_LSSurvey[SurveyAnswerEnglish]))

 

Thanks for trying to help @amitchandak

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.