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
Emmy66
Helper IV
Helper IV

Create a table to hold 2 Measures

Hi,

I'm trying to create a clustered bar chart where I have 10 measures. My intention is to have 2 of the measures grouped or stored in a table so that there will be spaces between each pair.

currently my bar chart looks like this:

Emmy66_2-1609165660594.png

 

 

Expected output for the bar chart

Emmy66_1-1609165558899.png

 

 

Each purple and green bar represents a measure. I'm trying to replicate this chart in PBI as it was originally created in excel.

 

Metrics_Charts_OM_Logon =
UNION
(SELECTCOLUMNS('Key Metrics OM',"YourSelection",[% All_Users_w_login_activity]),
SELECTCOLUMNS('Key Metrics Partner OM',"Firm",[% Partners_Only_OM_Logon])
)
I've tried doing a union to combine 2 measures but unfortunately I couldn't go any further. My intention is for Metrics_Charts_OM_Logon to be held in a table which I can use to plot the chart. Is just an idea but maybe someone might have a better approach. Your assistance on this will be appreciated.
6 REPLIES 6
fhill
Resident Rockstar
Resident Rockstar

Try this useful trick...  Most Charts in Power BI allow you to assign Multiple VALUES.  Each of these Values will group together simular to what you were looking to make...  

 

Create a Measure of one set of bars (let's say the Purple Lines in your example)

Gropu A = CALCULATE(SUM('Table (2)'[Values]), FILTER('Table (2)', 'Table (2)'[Group] = "A"))
Then create a Second Measure of the other set of Bars (let's say the Green Lines in your example)
Gropu B = CALCULATE(SUM('Table (2)'[Values]), FILTER('Table (2)', 'Table (2)'[Group] = "B"))
 
Here's some sample data I put together, remember BOTH sets of lines have to SHARE a vertical Axis in common.  In this example, we are Grouping (by Color) Group = A or Group = B, but the Shared Axis values have to be in common as well.
image.png
And here's the set-up with BOTH Measures in the Values.
image.png

 




Did I answer your question, or help you along the way?
Please give Kudos or Mark as a Solution!


https://www.linkedin.com/in/forrest-hill-04480730/

Proud to give back to the community!
Thank You!




Hi @fhill , thanks for your response. Very much appreciated. What you illustrated is exactly what I intend to achieve. Like you mentioned, that I should create a measure of one set of bars (how do I accomplish that please?) Currently I have 10 measures that are dynamically calculated (all expressed in %) which I've created e.g. the measures are based on the calculation below.

Emmy66_0-1609200580857.png

 

I have 6 other measures calculated in same manner. The measures with prefix Partners_Only (represents the purple bar) and the prefix All_users (represents the green bar).  With the above measures, how do I implement your suggestion please bearing in mind that the measures are not held in any table but calculated on the fly?
fhill
Resident Rockstar
Resident Rockstar

In my example, the 2 Measures have filters of the source data that allow both sets of data to be displayed on the same chart without overlap (Legend). 

 

It looks like your example measures are DIVIDING other measures?  You'll need to post an example of your source data for us to help you with the actual Measure code.  

 

 




Did I answer your question, or help you along the way?
Please give Kudos or Mark as a Solution!


https://www.linkedin.com/in/forrest-hill-04480730/

Proud to give back to the community!
Thank You!




@fhill, please see below my measures used. I hope it helps. Thanks in advance.

 

Emmy66_0-1609266143530.png

 

Hi @amitchandak , thanks for your reply. I'm not looking for a measure slicer. @fhill's response is what I intend to achieve. I hope it will guide you to understand my expected output.

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.