Forum Discussion
Highlight every week's total in table
Hi Team,
I have table column with dates of a month and sales figures against each of the dates.
There are two requirements with this data
1) Get the total sales for a week. After that total has to reset and get calculated for the next week.
2) The total for every week should be highlighted in the table control showing the data.
For #1, I am doing a cumulative total using sales data for dates in a week and then it resets for the next week and starts the calculation again for the new week as shown below
For this I have a measure in place which does the weekly calculation.
WeeklyTotal =
hi, manishpadmajan
use below measure for conditional formatting
Measure = var a = CALCULATE(MAX('Table (2)'[weekly total]),ALLEXCEPT('Table (2)','Table (2)'[week])) return IF(MIN('Table (2)'[weekly total])=a,"#FFFF00")1. click on weekly total coluymn
and follo step in iamge
change format style to field value
3. click on table name where measure is present and choose that measure and click on OK
download .pbix file click HERE
- Anonymous2 years ago
For your question, you've completed the first requirement, and here I'm helping you with the second:
Here's some dummy data, based on what you provided, I also created the "week" calculated column.
You want to highlight the weekly total, you can create a measure to query the last day of the week and makes it as “1”.
IsLastDayOfWeek = var max_date = CALCULATE(MAX('Table'[Date]), FILTER(ALL('Table'), 'Table'[Week] = MAX('Table'[Week]) )) var _date = SELECTEDVALUE('Table'[Date]) return IF(_date = max_date, 1, 0)Set the highlight for “WeeklyTotal” according to the “IsLastDayOfWeek”
Here is the result
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- Dangar332
Resident Rockstar
hi, manishpadmajan
use below measure for conditional formatting
Measure = var a = CALCULATE(MAX('Table (2)'[weekly total]),ALLEXCEPT('Table (2)','Table (2)'[week])) return IF(MIN('Table (2)'[weekly total])=a,"#FFFF00")1. click on weekly total coluymn
and follo step in iamge
change format style to field value
3. click on table name where measure is present and choose that measure and click on OK
download .pbix file click HERE
- AnonymousNot applicable
For your question, you've completed the first requirement, and here I'm helping you with the second:
Here's some dummy data, based on what you provided, I also created the "week" calculated column.
You want to highlight the weekly total, you can create a measure to query the last day of the week and makes it as “1”.
IsLastDayOfWeek = var max_date = CALCULATE(MAX('Table'[Date]), FILTER(ALL('Table'), 'Table'[Week] = MAX('Table'[Week]) )) var _date = SELECTEDVALUE('Table'[Date]) return IF(_date = max_date, 1, 0)Set the highlight for “WeeklyTotal” according to the “IsLastDayOfWeek”
Here is the result
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.