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

Remove measurement negative values

Hello friends,

 

I am having a problem in SUGESTÃO DE COMPRAS measurement When in my context only one store is being filtered, the measure works correctly not subtracting the negative values ​​and appearing zeroed. However, when filtering more than one store, as in the example below, the stores ALDEOTA and MESSEJANA, the measure subtracts the negative value of a store by the positive of another store, changing the TOTAL, but there should be no such subtraction, precisely because negative values were replaced by "0".

 

Sugestão de Compras = IF(
                          HASONEVALUE(ditens[Tamanho]);
                          IF(
                              [Calc Sugestão de Compras]>=0;
                              [Calc Sugestão de Compras];0
                            );
                          SUMX(
                              SUMMARIZE(
                                        VALUES(ditens[Tamanho]);
                                         [Tamanho];
                                         "AgrupaTamanho";
                                         IF(                                                                                                                             [Calc Sugestão de Compras]>=0;
                                            [Calc Sugestão de Compras];0
                                           )
                                         )
                               ;[AgrupaTamanho]
                              )
                      )

 

Can anyone help me with this problem?

 

I am making available the .pbix file and below the explanatory image.

file .PBIX

 

 

 

image.jpg

 

IMAGE2.jpg

 

 

 

1 ACCEPTED SOLUTION
v-sihou-msft
Employee
Employee

@leudyston

 

In this scenario, I don't think it's possible to control the sub total result with DAX. On each row level total, it still takes the slicer from ditens[Tamanho]. So it will always calculate all [Calc Sugestão de Compras] then apply the condition, the logic can never go to this part: 

 

SUMX(
                              SUMMARIZE(
                                        VALUES(ditens[Tamanho]);
                                         [Tamanho];
                                         "AgrupaTamanho";
                                         IF(                                                                                                                             [Calc Sugestão de Compras]>=0;
                                            [Calc Sugestão de Compras];0
                                           )
                                         )
                               ;[AgrupaTamanho]
                              )

Regards,

View solution in original post

1 REPLY 1
v-sihou-msft
Employee
Employee

@leudyston

 

In this scenario, I don't think it's possible to control the sub total result with DAX. On each row level total, it still takes the slicer from ditens[Tamanho]. So it will always calculate all [Calc Sugestão de Compras] then apply the condition, the logic can never go to this part: 

 

SUMX(
                              SUMMARIZE(
                                        VALUES(ditens[Tamanho]);
                                         [Tamanho];
                                         "AgrupaTamanho";
                                         IF(                                                                                                                             [Calc Sugestão de Compras]>=0;
                                            [Calc Sugestão de Compras];0
                                           )
                                         )
                               ;[AgrupaTamanho]
                              )

Regards,

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.