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
Anonymous
Not applicable

The Same week LY

Hi guys,
Can someone help Modify this DAX query

Iklizo_0-1655325913052.png

 

8 REPLIES 8
v-chenwuz-msft
Community Support
Community Support

Hi @Anonymous ,

 

The result of SELECTEDVALUE('Calendar'[Fiscal Year]) is blank due to you only have one field in this table, so the countrows( values( 'Calendar'[Fiscal Year]) >1 of each rows when you do not do some filter outside the table visual.

 

Or the selectedvalue( 'Calendar'[Fiscal week number]) is blank.

 

If im wrong, please let me know and share your pbix file without sensitive data.

 

Best Regards

Community Support Team _ chenwu zhu

 

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

 

 

 

vapid128
Solution Specialist
Solution Specialist

I never use the function like your function, so I tried yours, and it works.

 

my function :

 

weekly Sales LY = 
var maxYear = max('Calendar'[Fiscal Year])
var maxWeekNumber = max('Calendar'[Fiscal_week_number])

return 
CALCULATE(
    [sales],
    filter(ALL('Calender'),
        'Calendar'[Fiscal Year] = maxYear - 1 &&
        'Calendar'[Fiscal_week_number] = maxWeekNumber 
    )
)
Anonymous
Not applicable

@vapid128  Still return blank. 

show me your sales function and relationship between tables

Anonymous
Not applicable

@vapid128  My current works perfectly. 

Weekly Sales CY =
CALCULATE(
[sales],
FILTER(ALL('Calendar'),
'Calendar'[Fiscal Year] = SELECTEDVALUE('Calendar'[Fiscal Year]) &&
VALUE('Calendar'[Fiscal Week])= Value(SELECTEDVALUE('Calendar'[Fiscal Week]))))

I mean [sales]

vapid128
Solution Specialist
Solution Specialist

I tested your way, it should be work.

vapid128_0-1655334153067.png

 

Anonymous
Not applicable

@vapid128  Still not working for Weekly Sales LY. Do you have know another method?

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.