Forum Discussion

DanCasSan's avatar
DanCasSan
Helper V
5 years ago
Solved

Repeated values ​​in array

Hello partners!

 

I am performing the following calculation:

 

CFO BCP = CALCULATE(SUM(TBL_Patrimonio[MTO_CONCEPTO]),TBL_Patrimonio[DESC_CONCEPTO] IN {"CROSLAND CFO","FAMILY OFFICE BCP"})

 

But, when I put my matrix with the data it is repeating the same values ​​for each description.

What should I modify to achieve what I am putting in the formula is fulfilled? The data is in a single table.

 

 

Thank you!

Reggards.

 

DC

  • Since you are filtering the same column in your measure that is used in your visual, the measure filters are overwriting the one from the visual.  If you want to only show results for those two values, you can modify your measure like this.

     

    CFO BCP = CALCULATE(SUM(TBL_Patrimonio[MTO_CONCEPTO]),KEEPFILTERS(TBL_Patrimonio[DESC_CONCEPTO] IN {"CROSLAND CFO","FAMILY OFFICE BCP"}))

     

    If that is not what you are looking for, please show your desired output.

     

    Regards,

    Pat 

3 Replies

  • mahoneypat's avatar
    mahoneypat
    Microsoft Employee

    Since you are filtering the same column in your measure that is used in your visual, the measure filters are overwriting the one from the visual.  If you want to only show results for those two values, you can modify your measure like this.

     

    CFO BCP = CALCULATE(SUM(TBL_Patrimonio[MTO_CONCEPTO]),KEEPFILTERS(TBL_Patrimonio[DESC_CONCEPTO] IN {"CROSLAND CFO","FAMILY OFFICE BCP"}))

     

    If that is not what you are looking for, please show your desired output.

     

    Regards,

    Pat 

  • AllisonKennedy's avatar
    AllisonKennedy
    Community Champion

    DanCasSan  When you use a CALCULATE it modifies the filter context of your report and gives the same value. You can either use a visual level filter or try a SUMX instead. The SUMX will keep the current filter context of your table and add the additional filter context you apply to it.

     

     

     CFO BCP = SUMX( FILTER(TBL_Patrimonio, ,TBL_Patrimonio[DESC_CONCEPTO] IN {"CROSLAND CFO","FAMILY OFFICE BCP"} ), TBL_Patrimonio[MTO_CONCEPTO])

  • Hi,

    Does this work?

    CFO BCP = CALCULATE(SUM(TBL_Patrimonio[MTO_CONCEPTO]),filter(TBL_Patrimonio,TBL_Patrimonio[DESC_CONCEPTO] ="CROSLAND CFO"&&TBL_Patrimonio[DESC_CONCEPTO] ="FAMILY OFFICE BCP"))

    Hope this helps.