Renato Sandoval
Renato Sandoval

Reputation: 23

SUMX in DAX (PowerBi) isn´t working as supposed to

I am currently working on a PVM Analysis and everything was running smoothly. Until one of my measures fails to work. Both measures are practically the same:

One that works:

Novo =

VAR Novo = FILTER( CODITEM, [Revenue LY]+0=0) return

SUMX(Novo, [Revenue TY])

The failed one: Discontinued =

VAR Discontinued = FILTER(CODITEM, [Revenue TY]+0=0) return

SUMX(Discontinued,-[Revenue LY])

Both have to iterate into the "CODITEM" level. One only brings value when revenue LY = 0 and the other when revenue TY = 0.

Other measures here. Revenue TY = sum(TotalFat) Revenue LY = CALCULATE([Revenue TY],PREVIOUSMONTH('Date'[Date]))

In my BI filter the page by this month (so that I can see this month revenue in Revenue TY and last month revenue in Revenue LY).

I also attached the data and PBIX file in the link below:

https://drive.google.com/drive/folders/17ZJ3YwwiIaNJitIFNeaOLWNTap792ubc?usp=sharing

I can´t figure it out what this could it be.

Upvotes: 0

Views: 606

Answers (1)

alejandro_hagan
alejandro_hagan

Reputation: 1023

I don't see anything wrong with your formula. When I look at your data, I see that you are filtering the base1[quantfat] column for any Codeitem quantities that are equal to 0, and then pulling any associated revenue from those items.

However, when I look at your base1 table, I can see there are no entries where unit sales are equal to=0, therefore there is no associated revenue for items with zero [quantfat] which is why I think the measure is showing up blank.

Upvotes: 1

Related Questions