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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
peoplehelpme
Helper I
Helper I

Sum of of last week value from selected week

hi people . please help me to create 

sum of last week data from selected week

 

i got this date table

DateWeek numberWeek text

2021-01-03

1W1
2021-01-102W2
2021-01-173W3
2021-01-244W4
2021-01-315W5
2021-02-076W1
2021-02-147W2
2021-02-218W3
2021-02-289W4

 

and this data table (these two table are not connect in any relationship)

 

datenamevalue

2021-01-03

a1
2021-01-03b2
2021-01-10c3
2021-01-10d4
2021-01-10e5
2021-01-17f6
2021-01-17g7
2021-02-07h8
2021-02-07i9

 

when i select Jan-2021- W2 (these are 3 filters)

i want to get value 

last week=3

this week=12

 

another question is how can i do if i want to show item name

when i select Jan-2021- W2

i want to show data

last week=a,b

this week=c,d,e

 

 

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@peoplehelpme 

pls try to create 4 measure

 

last week value =
var _date=maxx(FILTER(all('Table'),'Table'[Date]<max('Table'[date])),'Table'[date])
return sumx(FILTER('Table 2','Table 2'[Date]=_date),'Table 2'[value])
 
this week value = sumx(FILTER('Table 2','Table 2'[Date]=max('Table'[Date])),'Table 2'[value])
 
last week item =
var _date=maxx(FILTER(all('Table'),'Table'[Date]<max('Table'[date])),'Table'[date])
return CONCATENATEX(FILTER('Table 2','Table 2'[Date]=_date),'Table 2'[name],",")
 
this week item = CONCATENATEX(FILTER('Table 2','Table 2'[Date]=max('Table'[Date])),'Table 2'[name],",")
 
11.png
 
pls see the attachment below
 
 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
ryan_mayu
Super User
Super User

@peoplehelpme 

pls try to create 4 measure

 

last week value =
var _date=maxx(FILTER(all('Table'),'Table'[Date]<max('Table'[date])),'Table'[date])
return sumx(FILTER('Table 2','Table 2'[Date]=_date),'Table 2'[value])
 
this week value = sumx(FILTER('Table 2','Table 2'[Date]=max('Table'[Date])),'Table 2'[value])
 
last week item =
var _date=maxx(FILTER(all('Table'),'Table'[Date]<max('Table'[date])),'Table'[date])
return CONCATENATEX(FILTER('Table 2','Table 2'[Date]=_date),'Table 2'[name],",")
 
this week item = CONCATENATEX(FILTER('Table 2','Table 2'[Date]=max('Table'[Date])),'Table 2'[name],",")
 
11.png
 
pls see the attachment below
 
 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Sorry sir, I got a problem of this formula, look like it doesnt work on some week selected

last week value =
var _date=maxx(FILTER(all('Table'),'Table'[Date]<max('Table'[date])),'Table'[date])
return sumx(FILTER('Table 2','Table 2'[Date]=_date),'Table 2'[value]) ,
here is example of table1
Dateweeknumweektextyearmonth
2024-04-07171W12024apr
2024-04-14172W22024apr
2024-04-21173W32024apr
2024-04-28174W42024apr
2024-05-05175W12024may
2024-05-12176W22024may
2024-05-19177W32024may
2024-05-26178W42024may
2024-06-02179W12024jun
 
and then i got data table
namedatevalueweeknum
a2024-04-071171
b2024-04-142172
c2024-04-283174
d2024-04-284174
e2024-05-055175
f2024-05-056175
g2024-05-127176
h2024-05-128176
i2024-05-129176

 

somehow when i select 2024,may, w1 ,

the value of last week should be 7 but this formula give me 10 which is wrong please help me

@peoplehelpme 

i didn't change any DAX, the output is 7, pls see the attachment below

 

11.PNG

 

pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

Top Solution Authors