Forum Discussion
Anonymous
6 years agoNot applicable
Column Bar Chart Split from the same data?
Good morning. I am working on a chart with some crime data. My boss would like a column chart showing crime data for the previous day and the current day, but he would also like to see a comparison...
- 6 years ago
Hi Anonymous ,
First, create an unrelated calendar table as slicer.
DimDate = ADDCOLUMNS(CALENDAR("20/04/2020","28/05/2020"),"week", WEEKNUM([Date]))Create measures to filter data from previous week and previous day.
last_day = IF(MAX('Table'[date])<=SELECTEDVALUE(DimDate[Date])&&MAX('Table'[date])>=SELECTEDVALUE(DimDate[Date])-1,1,0)Last Week = VAR CURRENT_WEEK = SELECTEDVALUE(DimDate[week]) VAR CURRENT_YEAR = YEAR(SELECTEDVALUE(DimDate[Date])) RETURN IF(MAX('Table'[week])<=CURRENT_WEEK&&MAX('Table'[week])>=CURRENT_WEEK-1&&YEAR(MAX('Table'[date]))=CURRENT_YEAR,1,0 )Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
6 years agoNot applicable
thank you. As a newbie though...is that coding something I need to enter? or is that the logic behind the slicer?
V-lianl-msft
6 years agoCommunity Support
Hi Anonymous ,
First, create an unrelated calendar table as slicer.
DimDate = ADDCOLUMNS(CALENDAR("20/04/2020","28/05/2020"),"week", WEEKNUM([Date]))Create measures to filter data from previous week and previous day.
last_day = IF(MAX('Table'[date])<=SELECTEDVALUE(DimDate[Date])&&MAX('Table'[date])>=SELECTEDVALUE(DimDate[Date])-1,1,0)Last Week =
VAR CURRENT_WEEK = SELECTEDVALUE(DimDate[week])
VAR CURRENT_YEAR = YEAR(SELECTEDVALUE(DimDate[Date]))
RETURN
IF(MAX('Table'[week])<=CURRENT_WEEK&&MAX('Table'[week])>=CURRENT_WEEK-1&&YEAR(MAX('Table'[date]))=CURRENT_YEAR,1,0
)
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.