Forum Discussion

felipevaz's avatar
felipevaz
Icon for Helper I rankHelper I
5 years ago
Solved

Using Two Excel Sheet Tables as filter in sum Dax

Hi,

 

I have three Excel tables: (start table, Codes and Subcodes)

 

 

Using Dax, I want to sum the field Value as a measure when I change the code and subcode (update all)...

 

All table are in the model.

 

I trying to use

 

calculate(sum(table[value],filter(table,table[codes] = codes[codes] && filter(table,table[subcode] = subcodes[subcodes])

 

off course this is giving me an error. I dont know how to implement that. Could you help me please?

 

  • felipevaz , Try meausre like

     

    calculate(sum(table[value]),filter(table,table[codes] in values(codes[codes]) && table[subcode] in values(subcodes[subcodes])))

    calculate(sum(table[value]),filter(table,table[codes] in allselected(codes[codes]) && table[subcode] in allselected(subcodes[subcodes])))

8 Replies

  • felipevaz , Ideally. You can join code and sub code with start table and they should filter automatically.

     

    Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

    • felipevaz's avatar
      felipevaz
      Icon for Helper I rankHelper I

      Heey, thnx wdx223_Daniel i didnt know that I could do it...Nice!!

       

      In my model I need to allow user to set Code and/or subcode independently...

       

      if the subcode is blank then just use the code....

      • wdx223_Daniel's avatar
        wdx223_Daniel
        Icon for Community Champion rankCommunity Champion

        felipevaz have you try my code? code and subcode are independent. you can update those columns, and click refresh all