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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

POWER BI DAX Classification on Measure and Measures as Visual Legend

Hi Experts,

I'm trying to build below kind of visual as an output, but visual legend setting is not taking measure.

Ma20114294_0-1670409088712.png

 


Basically, I was created a conditional measure based on below condition and trying to add this measure as visual Legend.

If Users had only one Unique session Id in a specified date range, then 1 Time
If Users had Two Unique Session Id's in a specified date range, then 1+ Times
If Users had Three Unique Session Id's in a specified date range, then 2+ Times
If Users had More than Three Unique Session Id's in a specified date range, then 3+ Times


And also if the user choose a date range in b/w months like from 15-Aug-2022 to 14-Sep-2022, the graph will still show two bars for each month, but the data must be filtered on the specified date range only.

Ma20114294_1-1670410041880.png

Please check and let me know if you find any other solutions. I've attached a sample .pbix file for your convenience.

https://drive.google.com/file/d/15Uvha9SUvYf5LOJeor2IAe8Hv6Be8VgR/view?usp=share_link

 

 

Regards,
Rommala

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi Team,
We were able to solve this by using disconnected table like below. 

Ma20114294_2-1670695975625.png

and created the following Measure 

Session Count (w Range) =
VAR _MinRange = MIN( 'Range Table'[MIN] )
VAR _MaxRange = MAX( 'Range Table'[MAX] )
RETURN
    IF( [SessionCount] >= _MinRange && [SessionCount] <= _MaxRange,
        [SessionCount],
        BLANK() )

and I added Range (from the new table) to your table visual

For chart, I created this measure (note that it relies on the measure above)

Unique Count = 
COUNTX( VALUES( data[USERRANK] ), [Session Count (w Range)] )

and I added the Range column as the chart legend

Ma20114294_3-1670696213175.png

 

Regards,

@Anonymous

 

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

You may download my solution workbook from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi Team,
We were able to solve this by using disconnected table like below. 

Ma20114294_2-1670695975625.png

and created the following Measure 

Session Count (w Range) =
VAR _MinRange = MIN( 'Range Table'[MIN] )
VAR _MaxRange = MAX( 'Range Table'[MAX] )
RETURN
    IF( [SessionCount] >= _MinRange && [SessionCount] <= _MaxRange,
        [SessionCount],
        BLANK() )

and I added Range (from the new table) to your table visual

For chart, I created this measure (note that it relies on the measure above)

Unique Count = 
COUNTX( VALUES( data[USERRANK] ), [Session Count (w Range)] )

and I added the Range column as the chart legend

Ma20114294_3-1670696213175.png

 

Regards,

@Anonymous

 

Anonymous
Not applicable

Hi @Pragati11,
I can not create a calculated column, because I need to apply condition on aggregate value. 

HI @Anonymous ,

What happens when you move this value to the y-axis section of your chart rather than in the legend?

Also can you share a screenhot around what fields you have moved to your chart?

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Pragati11
Super User
Super User

Hi @Anonymous ,

 

As per my knowledge, you can't move a measure to the LEGEND section of the visual. It has to be Column.

Unfortunately, you will have to create a calculated column rather than the measure as shown above; and then use it in the LEGEND section of your visual.

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.