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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
sammy02hk
Helper I
Helper I

Matrix table for Last last 4 week

I finally figure it out. Thank you all.

LLW Sales =

var LookupStart = LOOKUPVALUE(DateMatch[LLW],DateMatch[Date],
    SELECTEDVALUE(DateMatch[WkMonday]))
var Lookupend = (LOOKUPVALUE(DateMatch[LLW],DateMatch[Date],
    SELECTEDVALUE(DateMatch[WkMonday])))+6  
return
calculate(SUMX( 'Sales','Sales'[Sales]),
DATESINPERIOD(DateMatch[Date],LookupStart,7,DAY))



Hi there,

I would like to form a Matrix for last 4weeks.
I have upload the file:

1)

sammy02hk_0-1677832081893.png

2) And I can drag different parameter into the visual.

sammy02hk_1-1677832116376.png

 


I have tried using below syntax, but its not working.

LLW Sales =
var LookupStart = LOOKUPVALUE(DateMatch[LLW],DateMatch[Date],
    SELECTEDVALUE(DateMatch[WkMonday]))
var Lookupend = (LOOKUPVALUE(DateMatch[LLW],DateMatch[Date],
    SELECTEDVALUE(DateMatch[WkMonday])))+6  
return
calculate(SUMX( 'Sales','Sales'[Sales]),
 Sales[Billing_Date]>=LookupStart && Sales[Billing_Date]<=Lookupend)

Thank you for your help
Sammy Chu
1 ACCEPTED SOLUTION
sammy02hk
Helper I
Helper I

O... I finally figure it out. Thank you All.

LLW Sales =
var LookupStart = LOOKUPVALUE(DateMatch[LLW],DateMatch[Date],
    SELECTEDVALUE(DateMatch[WkMonday]))
var Lookupend = (LOOKUPVALUE(DateMatch[LLW],DateMatch[Date],
    SELECTEDVALUE(DateMatch[WkMonday])))+6  
return
calculate(SUMX( 'Sales','Sales'[Sales]),
DATESINPERIOD(DateMatch[Date],LookupStart,7,DAY))



View solution in original post

2 REPLIES 2
sammy02hk
Helper I
Helper I

O... I finally figure it out. Thank you All.

LLW Sales =
var LookupStart = LOOKUPVALUE(DateMatch[LLW],DateMatch[Date],
    SELECTEDVALUE(DateMatch[WkMonday]))
var Lookupend = (LOOKUPVALUE(DateMatch[LLW],DateMatch[Date],
    SELECTEDVALUE(DateMatch[WkMonday])))+6  
return
calculate(SUMX( 'Sales','Sales'[Sales]),
DATESINPERIOD(DateMatch[Date],LookupStart,7,DAY))



Hi @sammy02hk ,

 

I am so glad that you could solve your issue by yourself. Please kindly Accept your workaround as the solution. More people will benefit from it. 

 

Best Regards,
Rico Zhou

 

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors