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

Get Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.

Reply
sammy02hk
Helper I
Helper I

Sumx not working with summarize

Hi there,

I try to use sumx with summarize to group the article_code. However its not work as well. Which is work in my other bi report.

I would like to sum Sales by ArticleCode within the Period StartDate2 to +6. Thank you very much....

LW Sales 1 =
SUMX(
SUMMARIZE(
'Full 100013','Full 100013'[Article_Code],'Full 100013'[Billing_Date]),

Var StartDate = LOOKUPVALUE(DATA_LIST_CUR_DateMatch[LW],DATA_LIST_CUR_DateMatch[Date],
SELECTEDVALUE(DATA_LIST_CUR_DateMatch[WkMonday]))

Var StartDate2 = DATE(LEFT(StartDate,4),MID(StartDate,6,2),RIGHT(StartDate,2))

return
calculate(
SUMX('Full 100013','Full 100013'[Sales]),
filter(all('Full 100013'),'Full 100013'[Billing_Date]>= StartDate2 &&
'Full 100013'[Billing_Date]<= StartDate2 +6 )))

sammy02hk_0-1676361458005.png

Thank you very much....    

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @sammy02hk 

Maybe you can try the following code

LW Sales 1 =
Var StartDate = LOOKUPVALUE(DATA_LIST_CUR_DateMatch[LW],DATA_LIST_CUR_DateMatch[Date],
SELECTEDVALUE(DATA_LIST_CUR_DateMatch[WkMonday]))
Var StartDate2 = DATE(LEFT(StartDate,4),MID(StartDate,6,2),RIGHT(StartDate,2))

return
SUMX(filter(all('Full 100013'),'Full 100013'[Article_Code]=Max('Full 100013'[Article_Code])&&'Full 100013'[Billing_Date]>= StartDate2 &&
'Full 100013'[Billing_Date]<= StartDate2 +6 ),[Sales])

 

Best Regards!

Yolo Zhu

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
sammy02hk
Helper I
Helper I

Hi Yolo,

 

Thank you for your help ...

 

Sammy 

sammy02hk
Helper I
Helper I

I have try different way to write the syntax but it is not working at all. The no is correct, just cant group by with summarize.

Thank you for your help....

sammy02hk_1-1676367056997.png

 

sammy02hk_0-1676366984317.png

 

Anonymous
Not applicable

Hi @sammy02hk 

Maybe you can try the following code

LW Sales 1 =
Var StartDate = LOOKUPVALUE(DATA_LIST_CUR_DateMatch[LW],DATA_LIST_CUR_DateMatch[Date],
SELECTEDVALUE(DATA_LIST_CUR_DateMatch[WkMonday]))
Var StartDate2 = DATE(LEFT(StartDate,4),MID(StartDate,6,2),RIGHT(StartDate,2))

return
SUMX(filter(all('Full 100013'),'Full 100013'[Article_Code]=Max('Full 100013'[Article_Code])&&'Full 100013'[Billing_Date]>= StartDate2 &&
'Full 100013'[Billing_Date]<= StartDate2 +6 ),[Sales])

 

Best Regards!

Yolo Zhu

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

 

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.