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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
DGTL
Helper I
Helper I

DAX Measures WTD with DayNumber

Good morning,

I am asking you about a DAX measurement.

Indeed, I would like to compare the Y-1 value for the same NumDayWeek from the previous year.

In order to make a WTD

I have a date table

Can you help me ?

 

Capture d’écran 2023-11-03 à 11.09.44.png

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @DGTL 

 

You can try the following methods.

Measure:

Value Y = CALCULATE(MAX('Table'[Value]),FILTER(ALL('Table'),[Week]=SELECTEDVALUE('Table'[Week])&&[NumDayWeek]=SELECTEDVALUE('Table'[NumDayWeek])&&[Year]=YEAR(TODAY())))
Value Y-1 = CALCULATE(MAX('Table'[Value]),FILTER(ALL('Table'),[Week]=SELECTEDVALUE('Table'[Week])&&[NumDayWeek]=SELECTEDVALUE('Table'[NumDayWeek])&&[Year]=YEAR(TODAY())-1))

vzhangti_0-1699435857144.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-zhangti
Community Support
Community Support

Hi, @DGTL 

 

You can try the following methods.

Measure:

Value Y = CALCULATE(MAX('Table'[Value]),FILTER(ALL('Table'),[Week]=SELECTEDVALUE('Table'[Week])&&[NumDayWeek]=SELECTEDVALUE('Table'[NumDayWeek])&&[Year]=YEAR(TODAY())))
Value Y-1 = CALCULATE(MAX('Table'[Value]),FILTER(ALL('Table'),[Week]=SELECTEDVALUE('Table'[Week])&&[NumDayWeek]=SELECTEDVALUE('Table'[NumDayWeek])&&[Year]=YEAR(TODAY())-1))

vzhangti_0-1699435857144.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Jihwan_Kim
Super User
Super User

Hi, 

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1699070009336.png

 

 

Value Y: = 
SUM( Data[Value] )
Value Y-1: =
VAR _lastyear =
    MAX ( Data[Year] ) - 1
VAR _samenumdayweek =
    MAX ( Data[NumDayWeek] )
RETURN
    CALCULATE (
        SUM ( Data[Value] ),
        Data[Year] = _lastyear
            && Data[NumDayWeek] = _samenumdayweek
    )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Good morning,

Thank you for your reply,

But I would have to compare day 5 of week 2 of the year 2022

with day 5 of week 2, of the year 2023

 

Day 5 is not necessarily the same day. It's the fifth day of week 2.

You see ?

thanks again 🙂

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.