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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
laurianoe
New Member

DAX - 2 Slicers coming from the same field

Hello,

 

I am looking to see if I can get some help with a DAX Calculation or any other possible routes to approach the problem. The situation that I have is that I have a requirement where the business users would like to see the total sum of sales and the sales variance between two different categories (category value will come from the same category column). The problem that I have is when I make a DAX calculation to get the variance between the two categories it returns a blank value.

 

Currently what I am doing is duplicating my category filter slicer and I edit the interactions so they are not conflicting with each other.

 

laurianoe_0-1649876277118.png

 

I then create a DAX calculation to calculate the YTD sum of sales

 

Totals_YTD = CALCULATE('FactSales'[Sales Total], DATESYTD('DimTime'[Time]))

 

Totals_YTD_2 = CALCULATE('FactSales'[Sales Total], DATESYTD('DimTime'[Time]))

 

I then insert these calculations onto a card and apply the necessary category filter slicers and any other filters that are needed for each card.

 

laurianoe_1-1649876277126.png

 

laurianoe_2-1649876277137.png

 

 

 

Once I have these two cards ready, I then make a third card where this will display the variance (difference) between the two categories. 

 

Difference = Totals_YTD – Totals_YTD_2

 

However the card will return a blank value.

 

laurianoe_3-1649876277142.png

 

                     

laurianoe_4-1649876277152.png

 

 

 

A work around that I’ve been able to find is that I have to duplicate my fact table to achieve the desired result. The only issue with this, is that it takes up a lot of space and I would like to avoid this route.

 

Any suggestions would be appreciated!

1 ACCEPTED SOLUTION
truptis
Community Champion
Community Champion

Hi @laurianoe , 

Yes, you can have the second slicer for category coming from a duplicate table but if you don't wish to go through that option then you can refer the below link :

https://medium.com/creative-data/comparing-selected-categories-in-power-bi-b2ceedf78bfd 

 

@laurianoe Please hit the thumbs up & mark it as a solution if it helps you. Thanks.

View solution in original post

1 REPLY 1
truptis
Community Champion
Community Champion

Hi @laurianoe , 

Yes, you can have the second slicer for category coming from a duplicate table but if you don't wish to go through that option then you can refer the below link :

https://medium.com/creative-data/comparing-selected-categories-in-power-bi-b2ceedf78bfd 

 

@laurianoe Please hit the thumbs up & mark it as a solution if it helps you. Thanks.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.