Forum Discussion
Visualization To Compare Today, Yesterday, This Week, Last Week, This Month, Last Month?
- Anonymous8 years ago
pe2950,
If you want to involve all the data(Today, Yesterday, This Week, Last Week, This Month, Last Month) in a single visual, create the following similar measures in your table, you may need to replace the sum function with count function.
Today = CALCULATE(SUM(Table[appointments]),FILTER(Table,Table[Date]=TODAY()))
Yesterday = CALCULATE(SUM(Table[appointments]),FILTER(Table,Table[Date]=TODAY()-1))
This month = CALCULATE(SUM(Table[appointments]),FILTER(Table,YEAR(Table[Date])=YEAR(TODAY()) && MONTH(Table[Date])=MONTH(TODAY())))
Last month = CALCULATE(SUM(Table[appointments]),FILTER(Table,YEAR(Table[Date])=YEAR(TODAY())&&MONTH(Table[Date])=MONTH(TODAY())-1))
This week = CALCULATE(SUM(Table[appointments]),FILTER(Table,YEAR(Table[Date])=YEAR(TODAY())&&WEEKNUM(Table[Date])=WEEKNUM(TODAY())))
Last week = CALCULATE(SUM(Table[appointments]),FILTER(Table,YEAR(Table[Date])=YEAR(TODAY())&&WEEKNUM(Table[Date])=WEEKNUM(TODAY())-1))
Then you can create clustered column chart as shown in the following screenshot.
Regards,
Lydia
pe2950,
If you want to involve all the data(Today, Yesterday, This Week, Last Week, This Month, Last Month) in a single visual, create the following similar measures in your table, you may need to replace the sum function with count function.
Today = CALCULATE(SUM(Table[appointments]),FILTER(Table,Table[Date]=TODAY()))
Yesterday = CALCULATE(SUM(Table[appointments]),FILTER(Table,Table[Date]=TODAY()-1))
This month = CALCULATE(SUM(Table[appointments]),FILTER(Table,YEAR(Table[Date])=YEAR(TODAY()) && MONTH(Table[Date])=MONTH(TODAY())))
Last month = CALCULATE(SUM(Table[appointments]),FILTER(Table,YEAR(Table[Date])=YEAR(TODAY())&&MONTH(Table[Date])=MONTH(TODAY())-1))
This week = CALCULATE(SUM(Table[appointments]),FILTER(Table,YEAR(Table[Date])=YEAR(TODAY())&&WEEKNUM(Table[Date])=WEEKNUM(TODAY())))
Last week = CALCULATE(SUM(Table[appointments]),FILTER(Table,YEAR(Table[Date])=YEAR(TODAY())&&WEEKNUM(Table[Date])=WEEKNUM(TODAY())-1))
Then you can create clustered column chart as shown in the following screenshot.
Regards,
Lydia
- Anonymous8 years agoNot applicable
Last month = CALCULATE(SUM(Table[appointments]),FILTER(Table,YEAR(Table[Date])=YEAR(TODAY())&&MONTH(Table[Date])=MONTH(TODAY())-1))
If the Current month is January so last month should be Dec. But that not show any value in this case.
Can you please help me how I can manage if show last year Dec detail?
- arvindyadav7 years agoPost Partisan
Same problem I am also facing any solution for this?
- SivaMani7 years agoResident Rockstar
Try this,
Last month = CALCULATE(SUM(Table[appointments]),FILTER(ALL(Table),YEAR(Table[Date])=YEAR(TODAY())&&MONTH(Table[Date])=MONTH(TODAY())-1))
- Anonymous8 years agoNot applicable
When I use this Dax, But it starts the week start from Sunday to Saturday.
I need to set Dax in such a way that Week Start from Monday to Sunday.
Give the result accordingly!
- Anonymous5 years agoNot applicable
Hello Anonymous ,
Thank you for the above information!
The last week formula is not working if the current week is January 2021 first week and the last week is December 2020 last week.
The last month formula is not working if the current month is January 2021 and the last month is December 2020.
The above formulas are not showing any values in these cases.
Can you please let me know how to make last week, last month formulas work in the above scenarios.
Thank you!
Regards,
Aswini
- Anonymous4 years agoNot applicable
Million Thanks for sharing such a great logic in very simple way