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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
SteveG_91
Helper I
Helper I

Force Legend Not To Affect DAX measure

I have a table named “Created Apps” that contains applications that have been created.  Within that table is a column named “Action”.  One of the possible values for that column is “R”.  On the “R” records there will be a value in another column, named “Table”.  It looks like this.

 

APP_NUMBERACTIONTABLE
X1S 
X2R01
X3D 
X4R05
X5R06
X6S 
X7D 
X8R05
X9R05
X10R01

 

I’m trying to show the value of each unique “Table” as a percent of the Action = R records.  So Table 01 = 33% (2/6), 05 = 50% (3/6), 06 = 17% (1/6).  I want to plot this on a line graph to show the monthly trend over time, with a separate line for each Table

 

The issue I’m having is that when I use the measure to the visual and I add the Table as a legend it makes every value 100% because the legend is affecting both the numerator and denominator.  I want it to only affect the numerator.  I tried REMOVEFILTERS but that only works against a slicer.  How can I force it so the legend only affects the numerator in my divide measure?

1 ACCEPTED SOLUTION

I don't have enough info about your model, relationships and name of the date field you're using, but you likely need to change the measure to something like this...

 

D = 
CALCULATE (
    [CA],
    ALLSELECTED ( YourDateColumnName )
)

 

If that doesn't work, I'll need some additional detail to figure it out.

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

View solution in original post

4 REPLIES 4
KNP
Super User
Super User

If I understand correctly, the measures below will work.

 

CA = 
CALCULATE (
    COUNTROWS('Created Apps'),
    FILTER (
        'Created Apps',
        'Created Apps'[TABLE] <> ""
    )
)

 

D = 
CALCULATE (
    [CA],
    ALL ( 'Created Apps' )
)

 

% = 
DIVIDE (
    [CA],
    [D],
    BLANK ()
)

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

That's close.  The issue now is that while the denominator is not affected by the legend, as I was hoping, it is also not affected by the date that is on the X axis of my line chart.  So if over the last 12 month there were 10,000 created applications it is using 10,000 as the denominator for every month.  The numerator uses the correct monthly count but the denominator does not.

I don't have enough info about your model, relationships and name of the date field you're using, but you likely need to change the measure to something like this...

 

D = 
CALCULATE (
    [CA],
    ALLSELECTED ( YourDateColumnName )
)

 

If that doesn't work, I'll need some additional detail to figure it out.

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

That worked, thank you!

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.