Forum Discussion
Show different values in bar chart / line chart in the same visual
- 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.
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.
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 ?
- Anonymous2 years agoNot 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.