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
BMenescal
Regular Visitor

Measure CALCULATE(SUMX..... with IN works and NOT IN (<>) doens´t work... please help.

Hello everybody!

 

I´m new on power bi DAX....😥

I'm developing a measure and I didn't understand the reason for the behavior with the use of IN and Not in (<>).

 

The measure with IN works correctly and with NOT IN does not. The error below is displayed:
"Calculation error in measure (...) A table of multiple values was supplied where a single value was expected."

With IN:
Test Med. com LAST Simulação (Prod Saldo) = CALCULATE(Sumx('Fato Movimentação Fiscal'; 'Fato Movimentação Fiscal'[Valor Bruto (Modelo Agg Last)]); 'Natureza Operação'[Cod. Natureza Operação] = "8.888.01" ; FILTER('Tipo Movimento'; 'Tipo Movimento'[Cod. Tipo Movimento] IN {"2.2.32"; "2.2.17"}))

 
in_OK.png
 
 
 
 
 
 
 
 
 
 
 
 
 
 





With NOT IN:
Test Med. com LAST Simulação (Prod Saldo) not in = CALCULATE(Sumx('Fato Movimentação Fiscal'; 'Fato Movimentação Fiscal'[Valor Bruto (Modelo Agg Last)]); 'Natureza Operação'[Cod. Natureza Operação] = "8.888.01" ; FILTER('Tipo Movimento'; 'Tipo Movimento'[Cod. Tipo Movimento] <> {"2.2.32"; "2.2.17"}))
 
not_in_NOK.png 
 
Does anyone know the reason for this behavior? what am I doing wrong?

Thanks in advance.

Bru.

 

1 ACCEPTED SOLUTION
Gordonlilj
Solution Sage
Solution Sage

Hi,

 

Try something like

 

measure = CALCULATE(
    Sumx('Fato Movimentação Fiscal';
     'Fato Movimentação Fiscal'[Valor Bruto (Modelo Agg Last)]);
      'Natureza Operação'[Cod. Natureza Operação] = "8.888.01" ;
       FILTER('Tipo Movimento';
        NOT('Tipo Movimento'[Cod. Tipo Movimento]) IN {"2.2.32"; "2.2.17"}))

 

View solution in original post

5 REPLIES 5
Gordonlilj
Solution Sage
Solution Sage

Hi,

 

Try something like

 

measure = CALCULATE(
    Sumx('Fato Movimentação Fiscal';
     'Fato Movimentação Fiscal'[Valor Bruto (Modelo Agg Last)]);
      'Natureza Operação'[Cod. Natureza Operação] = "8.888.01" ;
       FILTER('Tipo Movimento';
        NOT('Tipo Movimento'[Cod. Tipo Movimento]) IN {"2.2.32"; "2.2.17"}))

 

Hi @Gordonlilj , thanks for reply.

I be able to display the values in the view without errors, but the values still wrong.... very strange. 

 

Look:
I don't understand ... but the values are very close to the correct.

not_yet.png

 

@BMenescal 

 

You may check if it is affected by some blank value.

 

 

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I changed the measure by adding a filter condition at the end of the formula to get the last day of the month:

 

Test Med. com LAST Simulação (Prod Saldo) not in = CALCULATE(Sumx('Fato Movimentação Fiscal'; 'Fato Movimentação Fiscal'[Valor Bruto (Modelo Agg Last)]); 'Natureza Operação'[Cod. Natureza Operação] = "8.888.01" ; FILTER('Tipo Movimento'; NOT 'Tipo Movimento'[Cod. Tipo Movimento] IN {"2.2.32"; "2.2.17"}) ; FILTER('Tempo'; DAY('Tempo'[Data Final]) = 'Tempo'[Último Dia Mês]))
 
Now it works!
 
works.png
 
 

@v-chuncz-msft thanks for the reply! I opened the values ​​in a specific month to check if they are ok ... The values ​​match but the result of the month is not correct because it should display the last value ....

 

look:

 

image1.png

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.