Forum Discussion

PowerBIBeginer's avatar
2 years ago

Logic / Dax require

Hi All,

 

Query which I'm asking I'm not sure whether its possible in power bi or not. Let me narrate the exact condition.

 

Col A - Customer name

Col B - Line of Business (could be anything)

Col C - Type (either Primary or Excess Or NLP)

 

 

Example:

Customer NameLoBType
Piramal IndHealthPrimary
Piramal IndHealth

Excess

NikeSportsExcess
TataTransportPrimary
TataFoodExcess
TataFoodPrimary
Piramal IndFoodExcess
SkyBagLifestylePrimary
SkyBagLifestyleExcess
SkyBagEntertainmentNLP
SkyBagEntertainmentExcess

 

If Customer Name and LoB same then check for Type.

Copy Excess type cases only when customer and LoB have primary type. If no primary type and any record have excess type records, skip those. Nothing to do with NLP type.

 

This is my query. Is this possible at all in power bi? KIndly Suggest..

 

 

 

8 Replies

  • Please show the expected outcome based on the sample data you provided.

    • PowerBIBeginer's avatar
      PowerBIBeginer
      Helper V

      Thank You for your reply and time share on my query.

      Customer NameLoBTypecomments
      Piramal IndHealthPrimary 
      Piramal IndHealthExcessCopy this row and paste in different table and should get delete from this current tabel
      NikeSportsExcess 
      TataTransportPrimary 
      TataFoodExcessCopy this row and paste in different table and should get delete from this current tabel
      TataFoodPrimary 
      Piramal IndFoodExcess 
      SkyBagLifestylePrimary 
      SkyBagLifestyleExcessCopy this row and paste in different table and should get delete from this current tabel
      SkyBagEntertainmentNLP 
      SkyBagEntertainmentExcess 

       

      Output will look like..

      Current table-

      Customer NameLoBType
      Piramal IndHealthPrimary
      NikeSportsExcess
      TataTransportPrimary
      TataFoodPrimary
      Piramal IndFoodExcess
      SkyBagLifestylePrimary
      SkyBagEntertainmentNLP
      SkyBagEntertainmentExcess

       

      and another table wil add those deleted rows

      Customer NameLoBType
      Piramal IndHealthExcess
      TataFoodExcess
      SkyBagLifestyleExcess
      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi PowerBIBeginer ,

         

        I made simple samples and you can check the results below:

        Measure = var _t = ADDCOLUMNS('Table',"Same",COUNTAX(FILTER(ALL('Table'),[Type]<>"NLP"&&[Customer Name]=EARLIER([Customer Name])&&[LoB]=EARLIER([LoB])),[Type]))
        var _t2 = IF(MAX('Table'[Type])="Excess",1,0)
        RETURN IF(MAXX(_t,[Same])<>1&&_t2=1,1,0)
        

         

        An attachment for your reference. Hope it helps!

         

        Best regards,
        Community Support Team_ Scott Chang

         

        If this post helps then please consider Accept it as the solution to help the other members find it more quickly.