Forum Discussion
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
- Anonymous2 years ago
Hi Kingnico63000 ,
If it contains a lot of dates, please try the following methods:
1.Create the simple table.
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.
5.Drag the two measures into the line and column chart.
6.The result is shown below.
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.
4 Replies
- amitchandak
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
- AnonymousNot 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.
2.Create the two slicers.
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.
7.The result is shown below.
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.
- Kingnico63000Regular Visitor
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 ?
- AnonymousNot applicable
Hi Kingnico63000 ,
If it contains a lot of dates, please try the following methods:
1.Create the simple table.
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.
5.Drag the two measures into the line and column chart.
6.The result is shown below.
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.