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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Kingnico63000
Regular Visitor

Show different values in bar chart / line chart in the same visual

Hello, 

 

I have data like this

 

N Value

1  1/01 5

1  2/01 4

2  1/01 6

2  2/01 5

3  1/01 4

3  2/01 7 

4  1/01 6

4  2/01 3

 

I want 2 slicers : One for value in bar chart and one for value in line chart 

 

If the user select 4 and 2 then 

 

there is bar chart with 1/01 2/01 with values 5 4 and line chart with 1/01 2/01 with values 6 5 

 

Do you know if it's posible ?

 

Thank you in advance 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Kingnico63000 ,

If it contains a lot of dates, please try the following methods:

1.Create the simple table.

vjiewumsft_0-1712626560149.png

2.Create the measure to filter based on slicer1.

 

Measureslicer1 = 
VAR sli1_n = SELECTEDVALUE('Table slicer1'[N])
RETURN
    CALCULATE(SUMX('Table', 'Table'[Value]), FILTER('Table', 'Table'[N] = sli1_n))

 

3.Create the measure to filter based on slicer2.

 

Measureslicer2 = 
VAR sli1_n = SELECTEDVALUE('Table slicer2'[N])
RETURN
    CALCULATE(SUMX('Table', 'Table'[Value]), FILTER('Table', 'Table'[N] = sli1_n))

 

4.Select 2 in the slicer1 and select 4 in the slicer2.

vjiewumsft_1-1712626620361.png

5.Drag the two measures into the line and column chart.

vjiewumsft_2-1712626626860.png

6.The result is shown below.

vjiewumsft_3-1712626634081.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
Anonymous
Not applicable

Hi @Kingnico63000 ,

First of all, many thanks to @amitchandak  for your very quick and effective replies, and I will give some additions below:

1.Create the simple table.

vjiewumsft_0-1712214806112.png

2.Create the two slicers.

vjiewumsft_1-1712214830239.png

3.Create the two measures to calculate values based on slicer1.

 

sli1_Date1 = 
VAR slicer1_n = SELECTEDVALUE('Table slicer1'[N])
RETURN
    CALCULATE(SUM('Table'[Value]), FILTER('Table', 'Table'[N] = slicer1_n && 'Table'[Date] = DATE(2024,1,1)))
slicer1_date2 = 
VAR slicer1_n = SELECTEDVALUE('Table slicer1'[N])
RETURN
    CALCULATE(SUM('Table'[Value]), FILTER('Table', 'Table'[N] = slicer1_n && 'Table'[Date] = DATE(2024,2,1)))

 

4.Create the two measures to calculate values based on slicer2.

 

slicer2_Date1 = 
VAR slic2_n = SELECTEDVALUE('Table slicer2'[N])
RETURN
    CALCULATE(SUM('Table'[Value]), FILTER('Table', 'Table'[N] = slic2_n && 'Table'[Date] = DATE(2024,1,1)))
slicer2_date2 = 
VAR sli2_n = SELECTEDVALUE('Table slicer2'[N])
RETURN
    CALCULATE(SUM('Table'[Value]), FILTER('Table', 'Table'[N] = sli2_n && 'Table'[Date] = DATE(2024,2,1)))

 

5.Create the measure to show different date values based on slicer.

 

Slicer1 = 
SWITCH(
    TRUE(),
    SELECTEDVALUE('Table'[Date]) = DATE(2024,1,1), [sli1_Date1],
    SELECTEDVALUE('Table'[Date]) = DATE(2024,2,1), [slicer1_date2]
)
Slicer2 = 
SWITCH(
    TRUE(),
    SELECTEDVALUE('Table'[Date]) = DATE(2024,1,1), [slicer2_Date1],
    SELECTEDVALUE('Table'[Date]) = DATE(2024,2,1), [slicer2_date2]
)

 

6.Create the line and column chart, drag the date field into the X-axis and drag slicer1 into the column Y-axis and drag the slicer2 into the Line y-axis.

vjiewumsft_2-1712215044597.png

7.The result is shown below.

vjiewumsft_3-1712215057547.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.

Hello,

 

Thank you but my problem is that Date can be extended to more than 2 dates ... It can be contains a lot of dates ... Does it complicates your solution ?

Anonymous
Not applicable

Hi @Kingnico63000 ,

If it contains a lot of dates, please try the following methods:

1.Create the simple table.

vjiewumsft_0-1712626560149.png

2.Create the measure to filter based on slicer1.

 

Measureslicer1 = 
VAR sli1_n = SELECTEDVALUE('Table slicer1'[N])
RETURN
    CALCULATE(SUMX('Table', 'Table'[Value]), FILTER('Table', 'Table'[N] = sli1_n))

 

3.Create the measure to filter based on slicer2.

 

Measureslicer2 = 
VAR sli1_n = SELECTEDVALUE('Table slicer2'[N])
RETURN
    CALCULATE(SUMX('Table', 'Table'[Value]), FILTER('Table', 'Table'[N] = sli1_n))

 

4.Select 2 in the slicer1 and select 4 in the slicer2.

vjiewumsft_1-1712626620361.png

5.Drag the two measures into the line and column chart.

vjiewumsft_2-1712626626860.png

6.The result is shown below.

vjiewumsft_3-1712626634081.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.

 

amitchandak
Super User
Super User

@Kingnico63000 , Seems like you need slicer on N, then you can use interactions to separate out 2 slicers snd visuals

 

How Interactions Work- Split Page using interactions to compare - https://youtu.be/GIfRKzhMaR4

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Solution Authors