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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
TusharGaurav
Helper III
Helper III

How to show multiple lines based on the slicer values selected when there are 2 different slicers.

Hi Experts,

 

In my report I am showing a line chart having revenue trend with respect to Date.

There are two slicers i.e. for Country and Product Group.

If nothing is selected, there will be only one line however if any Product Group is selected the the line chart should display multiple line Corresponding to the Countries which belong to the Product Group selected.

e.g. If Product Group "Clothing Line" is selected which have "India" and "USA", then in the line chart two different line should be displayed.

Can you please let me know how we achieve this scenario in PowerBI.

 

 

Thanks and Regards,

Tushar Gaurav

 

1 ACCEPTED SOLUTION
mdaatifraza5556
Super User
Super User

Hi @TusharGaurav 

Can you please try the below DAX.


DynamicRevenue =
VAR IsProductGroupSelected =
    ISFILTERED('Table'[ProductGroup])
RETURN
IF(
    IsProductGroupSelected,
    SUM('Table'[Revenue]),
    CALCULATE(
        SUM('Table'[Revenue]),
        REMOVEFILTERS('Table'[Country])  
    )
)


x-axis --- Date
y-axis---- DynamicRevenue
legend--- Country
 
 
before selecting
Screenshot 2025-04-18 143254.png

 

After selecting
Screenshot 2025-04-18 143302.png

 

 
If this answers your question, kindly accept it as solution and give kudos.

View solution in original post

7 REPLIES 7
v-achippa
Community Support
Community Support

Hi @TusharGaurav,

 

Thank you for reaching out to Microsoft Fabric Community.

 

Thank you @mdaatifraza5556 for the prompt response.

 

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by the super user resolved your issue?
If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

 

Thanks and regards,

Anjan Kumar Chippa

mdaatifraza5556
Super User
Super User

Hi @TusharGaurav 

Can you please try the below DAX.


DynamicRevenue =
VAR IsProductGroupSelected =
    ISFILTERED('Table'[ProductGroup])
RETURN
IF(
    IsProductGroupSelected,
    SUM('Table'[Revenue]),
    CALCULATE(
        SUM('Table'[Revenue]),
        REMOVEFILTERS('Table'[Country])  
    )
)


x-axis --- Date
y-axis---- DynamicRevenue
legend--- Country
 
 
before selecting
Screenshot 2025-04-18 143254.png

 

After selecting
Screenshot 2025-04-18 143302.png

 

 
If this answers your question, kindly accept it as solution and give kudos.

Thanks a lot for help.

l have one doubt, ie suppose l dont select any country, the in the chart's legend there will be legend of more than 100 countries and the line in the line chart is also multicoloured.

ls it possible to have "all"as legend in place of multiple country legend.

your response is really important.

 

Thanks and Regards,

Tushar Gaurav 

Hi @mdaatifraza5556 

 

Thanks for your response.

But this dax is not working.

Actually my requrirement is to display multiple lines corresponding to countries belonging to the Product group selected.

e.g. If Product Group "Clothing Line" is selected which have "India" and "USA", then in the line chart two different line should be displayed.

When I use the dax measure, the line chart is still showing a single line.

Can you please help.

 

Thanks and Regards,

Tushar Gaurav

Hi @TusharGaurav 

As you can see the above I have shared the snapshot of the output.

You can see the first image if not selected the productgroup then it shows
a single line which shows overall.

And when productgroup is selected then the two line chart is displayed

Screenshot 2025-04-18 143254.png

 

Screenshot 2025-04-18 143302.png

 

Hi @TusharGaurav 

As you can see the above I have shared the snapshot of the output.

You can see the first image if not selected the productgroup then it shows
a single line which shows overall.

And when productgroup is selected then the two line chart is displayed

Screenshot 2025-04-18 143254.png

 

Screenshot 2025-04-18 143302.png

 

Hi @TusharGaurav 

As you can see the above I have shared the snapshot of the output.

You can see the first image if not selected the productgroup then it shows
a single line which shows overall.

And when productgroup is selected then the two line chart is displayed

Screenshot 2025-04-18 143254.png

 

Screenshot 2025-04-18 143302.png

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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