Forum Discussion
Jiangmei_wu
3 years agoFrequent Visitor
Count current week and previous week
Hi there, I have to count current week and previous week using a visualization card each week. here is the excel file. The Dax I wrote for previous week gave me a blank. for current week, I simplely...
- Anonymous3 years ago
Hi Jiangmei_wu ,
Create this measure.
Measure = var a=SUMMARIZE(ALLSELECTED(Sheet1),Sheet1[location],[Week number],[Date 1],"Current Week Count",[Current Week Count]) return MAXX(FILTER(a,[location] in VALUES(Sheet1[location])&&[Week number] in VALUES(Sheet1[Week number])),[Current Week Count])Measure 2 = SUMX(VALUES('Sheet1'[location]),[Measure])Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous3 years ago
Hi Jiangmei_wu ,
You just need to place [MEASURE] on the card visual object.
Best Regards,
Neeko Tang
Greg_Deckler
Community Champion
3 years ago Couple ways to potentially make this easier. One, use Power Query to create a week offset column:
InsertWeekOffset = Table.AddColumn(InsertWeeknYear, "CurrWeekOffset", each (Number.From(Date.StartOfWeek([Date], Day.Monday))-Number.From(Date.StartOfWeek(CurrentDate, Day.Monday)))/7, type number),
Shout out to Melissa de Korte for the code.
Another way would be Sequential: https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Sequential/m-p/380231#M116
Jiangmei_wu
3 years agoFrequent Visitor
Greg, sorry, I misled you. my question is how to count each employee each week showed up how many times for current week and previous week (two dax - one for current week and one for previous week).