cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Mann Helper V
Helper V

As per Slicer value measure should change in Line Graph

Hi All,

 

I have created a line chart where I am showing fives lines coming from five measures dragged to "Values" section with Axis having "Datetime" field.

Measure calculation is similar for all five with different filter context coming from a single column [Type] as shown:

Measure 1:= CALCULATE([Count],'Table1'[Type]="Type A")
Measure 2:= CALCULATE([Count],'Table1'[Type]="Type B")
Measure 3:= CALCULATE([Count],'Table1'[Type]="Type C")
Measure 4:= CALCULATE([Count],'Table1'[Type]="Type D")
Measure 5:= CALCULATE([Count],'Table1'[Type]="Type E")

Graph is showing five lines with respect to these five measure.

I also have a slicer on this column = [Type]

 

I want:

1) If I select any one value (Type A or Type B or Type C or Type D or Type E) from this [Type] slicer only for that type, line should come on chart and others should go away.

2) If I select any two or more than two values from slicer then only those lines should be there for which type values are selected from slicer.

 

I tried using SELECTEDVALUE but it doesn't give required results. As shown for new measure 1:

Measure 1 New = IF(CALCULATE(SELECTEDVALUE('Table1'[Type A])="Type A"),Measure 1,BLANK())

This works fine if I select slicer one by one but if I select any other slicer with slicer value = Type A then it fails.

 

Please advice.

Thanks

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Mann Helper V
Helper V

Re: As per Slicer value measure should change in Line Graph

Thanks for checking in Ashish.

I could solve this using CONTAINS() DAX function instead of SELECTEDVALUE().

 

Here is the code. I have to replace these five old measure to these new ones to accomplish which I need.

Measure 1 New = 
VAR A =
    Measure 1
RETURN
    IF (
        CONTAINS (
            'Table1',
            'Table1'[Type A], "Type A"
        ),
        A,
        BLANK ()
    )

Thanks for the help!

 

 

View solution in original post

3 REPLIES 3
Super User IV
Super User IV

Re: As per Slicer value measure should change in Line Graph

Hi,

Writing 5 measures should not be necessary.  To help further, i will need to see your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Mann Helper V
Helper V

Re: As per Slicer value measure should change in Line Graph

Thanks for checking in Ashish.

I could solve this using CONTAINS() DAX function instead of SELECTEDVALUE().

 

Here is the code. I have to replace these five old measure to these new ones to accomplish which I need.

Measure 1 New = 
VAR A =
    Measure 1
RETURN
    IF (
        CONTAINS (
            'Table1',
            'Table1'[Type A], "Type A"
        ),
        A,
        BLANK ()
    )

Thanks for the help!

 

 

View solution in original post

Super User IV
Super User IV

Re: As per Slicer value measure should change in Line Graph

Hi,

Sorry but with such scanty information, i really cannot help.


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

Helpful resources

Announcements
Announcing the New Spanish Forum

Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

‘Better Together’ Integration Forum Launch

‘Better Together’ Integration Forum Launch

We've launched a how-to forum where you can learn about how Power BI integrates with other Power Platform products.

Top Solution Authors
Top Kudoed Authors