Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
I have a table with a daily snapshot of some simple data:
Order | Value | SnapDate |
100 | 5 | 01.01.2021 |
101 | 5 | 01.01.2021 |
102 | 5 | 01.01.2021 |
100 | 5 | 02.02.2021 |
Now I would like to determine the number of rows for the latest SnapDate in the previous week compared to the atest entry of this week.
It is possible that the latest entry for last week is Friday or Saturday instead of Sunday. Therefore the dax measure should check what is the latest date in the last week and then calculate the number of rows. But how?
Hi @joshua1990 ,
You can create a measure with below :-
Count_data =
VAR previous_week_num =
WEEKNUM ( MAX ( snap_data[SnapDate] ), 1 ) - 1
VAR max_date_prev_week =
CALCULATE (
MAX ( snap_data[SnapDate] ),
WEEKNUM ( snap_data[SnapDate], 1 ) = previous_week_num
)
RETURN
CALCULATE (
COUNTROWS ( snap_data ),
FILTER ( snap_data, MAX ( snap_data[SnapDate] ) = max_date_prev_week )
)
Thanks,
Samarth
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
User | Count |
---|---|
21 | |
14 | |
11 | |
8 | |
5 |
User | Count |
---|---|
24 | |
22 | |
20 | |
15 | |
10 |