Forum Discussion

Sander_NL's avatar
Sander_NL
Helper I
8 years ago
Solved

Calculation based on other colum with multiple values separated by _

I would like to have a new column which, based on the new count column (= measure _MNewCount), calculates the rate calculated on the basis of the colour column in the Tariff table.

 

The source csv file delivers a  column with color_color_color convention with a different numbers of colors so can be 1 to several seperated by "_".

 

Some products have no color option. Sometimes there are also colours that do not appear in the rates table which may then be ignored. 

 

What is de best approach?

 

 Thanks in advance for your help!

 

Concept PBIX file https://www.dropbox.com/s/zjrvh66165b7khd/Color.pbix?dl=0

 

 

  • Hi,

     

    Try this formula

     

    =if(HASONEVALUE('Product'[Product]),SUM('Product'[tariff])*[_MNewCount],SUMX(SUMMARIZE('Product','Product'[Product],"ABCD",SUM('Product'[tariff])*[_MNewCount]),[ABCD]))

     

    Hope this helps.

6 Replies

  • I would like to have a new column which, based on the new count column (= measure _MNewCount), calculates the rate calculated on the basis of the colour column in the Tariff table.

     

    The source csv file delivers a  column with color_color_color convention with a different numbers of colors so can be 1 to several seperated by "_".

     

    Some products have no color option. Sometimes there are also colours that do not appear in the rates table which may then be ignored. 

     

    What is de best approach?

     

    Thanks in advance for youor help!

     

    Concept PBIX file:

     

    https://www.dropbox.com/s/zjrvh66165b7khd/Color.pbix?dl=0

    • Ashish_Mathur's avatar
      Ashish_Mathur
      Super User

      Hi,

       

      What exact numerical answer are you expecting in a new column of your visual?

      • Sander_NL's avatar
        Sander_NL
        Helper I

        Hi thanks for your response Ashish:

         

        ProductOptionOrginal_countNew CountOutcome
        Test3Green_Grey_White4125400
        Test5Red_Blue392700
        Test4 260
        Test2Red26600
        Test1Red_Blue_Grey131350