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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
nghyn
Regular Visitor

Compare Data from 2 Slicer in one Database

Hi everyone,

I'm a newbie who recently started using PowerBI, so I don't have much experience yet. Currently, I'm facing an issue with comparing data within the same dataset. As shown in the first image, I need to separate two slicers corresponding to each set of charts:

  • Slicer 1 -> Chart 1
  • Slicer 2 -> Chart 2

Number 3 will display the comparison of data selected from the two corresponding slicers.

I've managed to separate them into two distinct slicers for each set of charts but haven't been able to integrate them into the comparison chart. I tried establishing a relationship from Slicer 1's data to the original data to display the comparison, but the numbers weren't correct.

Can someone please guide me on how to handle this data issue? Thank you very much!screenshot_1715671582.pngscreenshot_1715672410.png

4 REPLIES 4
johnbasha33
Solution Sage
Solution Sage

@nghyn  Try this approach

Create DAX Measures:

Create two measures, one for each set of charts, based on the selected slicers.
Let's call them "Measure 1" and "Measure 2".
These measures should filter the data based on the selections from their respective slicers.
Create a Comparison Measure:

Create a new measure to calculate the comparison between "Measure 1" and "Measure 2".
Use the FILTER function to apply the selections from both slicers to the original dataset.
Calculate the desired comparison between the filtered data sets.
Create the Comparison Chart:

Use the comparison measure created in step 2 to create a new chart.
This chart will display the comparison between the data selected from both slicers.

Measure 1 = CALCULATE(SUM('YourTable'[Value]), 'YourTable'[Category] = SELECTEDVALUE('Slicer1'[Category]))

Measure 2 = CALCULATE(SUM('YourTable'[Value]), 'YourTable'[Region] = SELECTEDVALUE('Slicer2'[Region]))

Comparison =
VAR Value1 = [Measure 1]
VAR Value2 = [Measure 2]
RETURN
Value1 - Value2

Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!



Measure 1: 

Customer_Site1 = CALCULATE(SUM(ALLDATA[CUSTOMER]),'Site Master'[STT])
Measure 2: 
Customer_Site2 = CALCULATE([Customer_Site1],USERELATIONSHIP(Calendar_Comparision[Date],ALLDATA[DATE]),USERELATIONSHIP(Site_Para_1[Name],ALLDATA[SITENAME]),REMOVEFILTERS('Calendar'),REMOVEFILTERS('Site Master'))

Thank you, but I Want to show 2 Measure in 1 chart , example in my image 

nghyn_0-1715697992810.png

I had separate them into two distinct slicers for each but in Chart the correct is just measure 1 and measure 2 is incorrect. This is my config in chart , is anything wrong in my chart , please help me 😞

nghyn_1-1715698112339.png

 

amitchandak
Super User
Super User

@nghyn , You need to follow this approach

 

Power BI Abstract Thesis: How to use two Date/Period slicers

https://youtu.be/WSeZr_-MiTg

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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