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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
stefani_vileva
Resolver II
Resolver II

Measure wrongly summing column

Hello, I have three measures for summing up quantities, the first Prev. week is suming the quantity of the previous week, the second PrePrev. week is summing the quantity of the previous previous week and the last one Prev. week year is summing the quantity of the same week but previous year. 

How it is possible to get some value in the total section but there is no value in the column?

 

Thank you in advance.

Best regards,

Stefani

 

stefani_vileva_0-1688366247354.png

 

1 ACCEPTED SOLUTION
stefani_vileva
Resolver II
Resolver II

I solved the problem. It was something wrong with the calculation of the week number, so instead of the formula above, I used the following code:

Previous year order (Kolli) = 

VAR WEEK_NUM = WEEKNUM(TODAY(), 2) - 1
VAR YEAR_WEEK = (YEAR(TODAY())-1)*100+WEEK_NUM
VAR YEAR_WEEK_RANK = CALCULATE(MAX('Date'[Week rank]), FILTER(All('Date'), 'Date'[Year week]=YEAR_WEEK))

VAR QUANTITY_PREVIOUS_YEAR_WEEK = CALCULATE(SUM(Lieferungs[KOLLI]), FILTER(ALL('Date'), 'Date'[Week rank]=YEAR_WEEK_RANK))

RETURN
    QUANTITY_PREVIOUS_YEAR_WEEK

View solution in original post

3 REPLIES 3
stefani_vileva
Resolver II
Resolver II

I solved the problem. It was something wrong with the calculation of the week number, so instead of the formula above, I used the following code:

Previous year order (Kolli) = 

VAR WEEK_NUM = WEEKNUM(TODAY(), 2) - 1
VAR YEAR_WEEK = (YEAR(TODAY())-1)*100+WEEK_NUM
VAR YEAR_WEEK_RANK = CALCULATE(MAX('Date'[Week rank]), FILTER(All('Date'), 'Date'[Year week]=YEAR_WEEK))

VAR QUANTITY_PREVIOUS_YEAR_WEEK = CALCULATE(SUM(Lieferungs[KOLLI]), FILTER(ALL('Date'), 'Date'[Week rank]=YEAR_WEEK_RANK))

RETURN
    QUANTITY_PREVIOUS_YEAR_WEEK
mlsx4
Memorable Member
Memorable Member

I'm not sure what's happening with your measure, but it seems to be a problem of the formula: are you using SUMX for each row?

 

You should have something like PreYear = SUMX(VALUES(Table[EAN]), [Prev. week year])

Hello @mlsx4,

 

I am not using SUMX, instead I am using SUM, the problem is that inside I am trying to calculate the same value for the previous week in the previous year, for example let say this year we are in 26 week, so I want to calculate what we had in 25 week in 2022.

The formulas that I am using is following:

 

Previous year order (Kolli) = 
VAR CURRENT_WEEK = MAXX(ALL('Date'), 'Date'[Week rank])-1
VAR PREVIOUS_WEEK = CURRENT_WEEK-1
VAR WEEK_NUM = CALCULATE(MAX('Date'[Week number]), FILTER('Date', 'Date'[Week rank]=PREVIOUS_WEEK))
VAR YEAR_WEEK = (YEAR(TODAY())-1)*100+WEEK_NUM
VAR YEAR_WEEK_RANK = CALCULATE(MAX('Date'[Week rank]), FILTER('Date', 'Date'[Year week]=YEAR_WEEK))

VAR QUANTITY_PREVIOUS_YEAR_WEEK = CALCULATE(SUM(Lieferungs[KOLLI]), FILTER(ALL('Date'), 'Date'[Week rank]=YEAR_WEEK_RANK))

RETURN
    QUANTITY_PREVIOUS_YEAR_WEEK

 

 With this formula, I am only getting value for the first row but not for all the others that should be also data.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.