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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
AbhayB
Frequent Visitor

Slicer related question

Hello Experts,

 

I have a requirement on a line graph to selets the lines based on Slicer value. Below is graph show and a slicer for the month.

Each line comes from a separate JSON source for each month.

The help need is - to select the month on the slicer which should show onyl that month's line in the graph.

Is this achieveable?

Slicer.jpg

 

Regards,

Abhay

1 ACCEPTED SOLUTION
v-lid-msft
Community Support
Community Support

Hi @AbhayB ,

 

We can try to create following measures as value field of line chart to meet your requirement:

 

April Frequency Measure =
IF (
    ISFILTERED ( 'Months'[Months] ),
    IF (
        "April" IN FILTERS ( 'Months'[Months] ),
        SUM ( '04 April 2019'[Frequency] ),
        BLANK ()
    ),
    SUM ( '04 April 2019'[Frequency] )
)

 

May Frequency Measure =
IF (
    ISFILTERED ( 'Months'[Months] ),
    IF (
        "May" IN FILTERS ( 'Months'[Months] ),
        SUM ( '05 May 2019'[Frequency] ),
        BLANK ()
    ),
    SUM ( '05 May 2019'[Frequency] )
)

 

June Frequency Measure =
IF (
    ISFILTERED ( 'Months'[Months] ),
    IF (
        "June" IN FILTERS ( 'Months'[Months] ),
        SUM ( '06 June 2019'[Frequency] ),
        BLANK ()
    ),
    SUM ( '06 June 2019'[Frequency] )
)

 

July Frequency Measure =
IF (
    ISFILTERED ( 'Months'[Months] ),
    IF (
        "July" IN FILTERS ( 'Months'[Months] ),
        SUM ( '07 July 2019'[Frequency] ),
        BLANK ()
    ),
    SUM ( '07 July 2019'[Frequency] )
)

 

August Frequency Measure =
IF (
    ISFILTERED ( 'Months'[Months] ),
    IF (
        "August" IN FILTERS ( 'Months'[Months] ),
        SUM ( '08 August 2019'[Frequency] ),
        BLANK ()
    ),
    SUM ( '08 August 2019'[Frequency] )
)

 

September Frequency Measure =
IF (
    ISFILTERED ( 'Months'[Months] ),
    IF (
        "September" IN FILTERS ( 'Months'[Months] ),
        SUM ( '09 September 2019'[Frequency] ),
        BLANK ()
    ),
    SUM ( '09 September 2019'[Frequency] )
)

 


Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-lid-msft
Community Support
Community Support

Hi @AbhayB ,

 

We can try to create following measures as value field of line chart to meet your requirement:

 

April Frequency Measure =
IF (
    ISFILTERED ( 'Months'[Months] ),
    IF (
        "April" IN FILTERS ( 'Months'[Months] ),
        SUM ( '04 April 2019'[Frequency] ),
        BLANK ()
    ),
    SUM ( '04 April 2019'[Frequency] )
)

 

May Frequency Measure =
IF (
    ISFILTERED ( 'Months'[Months] ),
    IF (
        "May" IN FILTERS ( 'Months'[Months] ),
        SUM ( '05 May 2019'[Frequency] ),
        BLANK ()
    ),
    SUM ( '05 May 2019'[Frequency] )
)

 

June Frequency Measure =
IF (
    ISFILTERED ( 'Months'[Months] ),
    IF (
        "June" IN FILTERS ( 'Months'[Months] ),
        SUM ( '06 June 2019'[Frequency] ),
        BLANK ()
    ),
    SUM ( '06 June 2019'[Frequency] )
)

 

July Frequency Measure =
IF (
    ISFILTERED ( 'Months'[Months] ),
    IF (
        "July" IN FILTERS ( 'Months'[Months] ),
        SUM ( '07 July 2019'[Frequency] ),
        BLANK ()
    ),
    SUM ( '07 July 2019'[Frequency] )
)

 

August Frequency Measure =
IF (
    ISFILTERED ( 'Months'[Months] ),
    IF (
        "August" IN FILTERS ( 'Months'[Months] ),
        SUM ( '08 August 2019'[Frequency] ),
        BLANK ()
    ),
    SUM ( '08 August 2019'[Frequency] )
)

 

September Frequency Measure =
IF (
    ISFILTERED ( 'Months'[Months] ),
    IF (
        "September" IN FILTERS ( 'Months'[Months] ),
        SUM ( '09 September 2019'[Frequency] ),
        BLANK ()
    ),
    SUM ( '09 September 2019'[Frequency] )
)

 


Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-lid-msftPerfect.

Thanks a ton. Save my time a lot.

VasTg
Memorable Member
Memorable Member

@AbhayB 

 

You need to do something similar to this post. If use april measure(or calculation) for april, june measure(or calculation) for June and so on.

 

https://community.powerbi.com/t5/Desktop/Slicer-MTD-QTD-YTD-to-filter-dates-using-the-slicer/td-p/50...

 

 

If this help, mark it as a solution

Kudos are good too

Connect on LinkedIn
AbhayB
Frequent Visitor

@VasTgThanks for your reply.

However, I am still unable to get what I am looking for.

 

Here is the screen shot that I get when I was trying to add a measure as suggested by you.

 

Error adding measureError adding measure

 

Please refer to details of data content -

- Data is separated by a JSON file for each month.

- "Name" field is only common matching field across all the month's data set.

- Note that there is no Date fields in any of dataset. I added a custom column as Month which has month name for all rows as I was trying to link it to slicer.

- The graph has "Name" and "Frequency" fields only.

- Table "Month" is a custom entered table that is added while referring to some of cummnity threads as a slicer. It has only 6 rows for month name with a index column as shown in slicer.

 

My requirment is -

- I want to click on Month name on the slicer, which should then display only that particular line in the chart. i.e. if i select April or August either one or all, then it should show only those lines for selected month.

- Only 2 visuals, one for the chart and other the slicer.

 

What I am unable to do is -

- How to link the slicer to all other tables?

- Where should be the measure field to be created?

 

Let me know if this explains better.

 

Regards,

Abhay

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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