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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Thalbish
Frequent Visitor

Multiple Slicers of same type in one graph

I want to insert two date slicers in one bar graph having two bars representing the total sales, each slicer will be used to filter one bar of total sales,so that i can compare total sales of two time period in one graph.

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

Hi @Thalbish ,

Please try the following methods and check if they can solve your problem:

1.Create the simple table.

vjiewumsft_9-1708583312664.png

2.Create two tables with slicer fields for the two slicers.

vjiewumsft_10-1708583326981.png

vjiewumsft_11-1708583333733.png

3.Drag the Date into the slicer 1 visual and drag the Date into slicer 2 visual.

vjiewumsft_12-1708583340524.png

vjiewumsft_13-1708583348435.png

 

4.Create two measures for the two slicers.

 

TotalSales1 = 
VAR start_date = MIN('Table slicer1'[Date])
VAR end_date = MAX('Table slicer1'[Date])
RETURN
    CALCULATE(SUM('Table'[Sales]), FILTER('Table', [Date] >= start_date && [Date] <= end_date))

TotalSales2 = 
VAR start_date = MIN('Table slicer2'[Date])
VAR end_date = MAX('Table slicer2'[Date])
RETURN
    CALCULATE(SUM('Table'[Sales]), FILTER('Table', [Date] >= start_date && [Date] <= end_date))

 

5.Create the Field table.

vjiewumsft_14-1708583386235.png

6.Create a measure to show a different measure.

 

Measure = 
SWITCH(
    TRUE(),
    SELECTEDVALUE(Field[Sales Fields]) = "Sales 1", [TotalSales1],
    SELECTEDVALUE(Field[Sales Fields]) = "Sales 2", [TotalSales2]
)

 

7.Select the bar chart, add the sales field into the Y-axis, drag the measure into the X-axis.

vjiewumsft_15-1708583423859.png

8.The result is shown below.

vjiewumsft_16-1708583430290.png

Best Regards,

Wisdom Wu

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-jiewu-msft
Community Support
Community Support

Hi @Thalbish ,

Please try the following methods and check if they can solve your problem:

1.Create the simple table.

vjiewumsft_9-1708583312664.png

2.Create two tables with slicer fields for the two slicers.

vjiewumsft_10-1708583326981.png

vjiewumsft_11-1708583333733.png

3.Drag the Date into the slicer 1 visual and drag the Date into slicer 2 visual.

vjiewumsft_12-1708583340524.png

vjiewumsft_13-1708583348435.png

 

4.Create two measures for the two slicers.

 

TotalSales1 = 
VAR start_date = MIN('Table slicer1'[Date])
VAR end_date = MAX('Table slicer1'[Date])
RETURN
    CALCULATE(SUM('Table'[Sales]), FILTER('Table', [Date] >= start_date && [Date] <= end_date))

TotalSales2 = 
VAR start_date = MIN('Table slicer2'[Date])
VAR end_date = MAX('Table slicer2'[Date])
RETURN
    CALCULATE(SUM('Table'[Sales]), FILTER('Table', [Date] >= start_date && [Date] <= end_date))

 

5.Create the Field table.

vjiewumsft_14-1708583386235.png

6.Create a measure to show a different measure.

 

Measure = 
SWITCH(
    TRUE(),
    SELECTEDVALUE(Field[Sales Fields]) = "Sales 1", [TotalSales1],
    SELECTEDVALUE(Field[Sales Fields]) = "Sales 2", [TotalSales2]
)

 

7.Select the bar chart, add the sales field into the Y-axis, drag the measure into the X-axis.

vjiewumsft_15-1708583423859.png

8.The result is shown below.

vjiewumsft_16-1708583430290.png

Best Regards,

Wisdom Wu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

 

 

 

Also can you please help me with applying this 2 date into a clustered bar graph which represent order type,i want one colour to represent the first date and another to other date as you have explained for salesclustered-bar-chart-alternatives_before.jpgAs you see in the above example i want one bar two represent delivery another with dine in and another with drive through, the clustered bar, ie;Orange and blue acts like when i set slicer for one date orange adjusts and other slicer adjusts blue,i also wanted to integrate this with our already created slicers 

audreygerred
Super User
Super User

Hi! When you say two time periods are you wanting two random, unrelated time periods (i.e. maybe your user wants to compare sept and october to june and july) or are you wanting to do time intelligence (i.e. if the user selects January and February of 2024, you are comparing to Jan and Feb of 2023)?





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

Proud to be a Super User!





Yes, I want two random time periods,that is in one graph i want to select jan 1st to Feb 31 of 2023,and in another i can select march 1 to april 31st in 2022,like wise random selection

 

Helpful resources

Announcements
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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.