Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
joshua1990
Post Prodigy
Post Prodigy

Compare this week value with latest value previous week

I have a table with a daily snapshot of some simple data:

OrderValueSnapDate
100501.01.2021
101501.01.2021
102501.01.2021
100502.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?

1 REPLY 1
Samarth_18
Community Champion
Community Champion

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

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.