Forum Discussion
Max Week in Month
- 4 years ago
Hi, andybamber ;
IF you create a column , try it.
No. Country = Var _MW = CALCULATE(max(Res[Week Of Month]),ALLEXCEPT(Res,'Res'[Month])) return IF([Week Of Month]=MAXX(FILTER(ALL('Res'),[Month]=EARLIER(Res[Month])),[Week Of Month]),1)The final output is shown below:
Or you could create a measure.
No. Country_m = Var _MW = CALCULATE(max(Res[Week Of Month]),ALLEXCEPT(Res,'Res'[Month])) return CALCULATE(COUNT(Res[z_country_key]),FILTER(ALL('Res'),EOMONTH([snaphot_stamp],0)=EOMONTH(MAX('Date_table'[Date]),0)&&[Week Of Month]=MAXX(FILTER(ALL('Res'),[Month]=MAX([Month])),[Week Of Month])&&[z_country_key]=MAX('Res'[z_country_key])))The final output is shown below:
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi andybamber
Can you post sample data as text and expected output?
Not enough information to go on;
please see this post regarding How to Get Your Question Answered Quickly:
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
4. Relation between your tables
Appreciate your Kudos!!
LinkedIn:www.linkedin.com/in/vahid-dm/
- andybamber4 years agoHelper III
Hi there! so this is the sample data... the data is joined to a date table on snapshot date
Snapshot Date User ID Country 02/11/2021 a1 Germany 02/11/2021 a2 Denmark 02/11/2021 a3 Denmark 02/11/2021 a4 Denmark 02/11/2021 a5 Denmark 02/11/2021 a6 Denmark 02/11/2021 a7 Denmark 09/11/2021 a2 Denmark 09/11/2021 a3 Denmark 09/11/2021 a4 Denmark 09/11/2021 a5 Denmark 09/11/2021 a6 Denmark 09/11/2021 a7 Denmark 16/11/2021 a2 Denmark 16/11/2021 a3 Denmark 16/11/2021 a4 Denmark 16/11/2021 a5 Denmark 16/11/2021 a6 Denmark 16/11/2021 a7 Denmark Output wise, the matrix should show for Nov 21 the following results:
Nov 2021 Denmark 6 This based on the latest week in November so far being 16/11/21
At the moment what I get is:
Nov 2021 Germany 1 Denmark 6 Which is the 6 for Denmark from 16/11/21 and the 1 from Germany from 2/11/21... i dont want to include any results from 2/11/21 or 9/11/21... just the latest week of the month
Hope this helps
Cheers
Andy
- VahidDM4 years agoSuper User
HI andybamber
Download this file: https://gofile.io/d/BuMMOO
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: www.linkedin.com/in/vahid-dm/- andybamber4 years agoHelper III
1