Forum Discussion

Saranya_Tamil's avatar
Saranya_Tamil
Frequent Visitor
3 years ago
Solved

Need help in DAX

I need to figure out whether the Deal is a S4U or not. The logic is if other than S4U in 'Name' field has S4U as family then it is a S4U deal. For ex, here 1 is not S4U bcz other than S4U no one has S4U as family and  2 is S4U deal because ERP in this has S4U family. I don’t know how to achieve this in power BI using DAX.

DealNameFamilyOutput
1ERPERPNo
1S4US4UNo
1ERPMSNo
1ERPPSNo
2ERPERPYes
2S4US4UYes
2ERPS4UYes
2ERPPSYes

 

Need the output as mentioned

  • rsbin's avatar
    rsbin
    3 years ago

    Saranya_Tamil ,

    Add this as a second Calculated Column:

    Output = SWITCH(
                 TRUE(),
                 CALCULATE( SUM([S4UDeal] ),
                      ALLEXCEPT( 'Deals (2)', 'Deals (2)'[Deal] )) > 0, "Yes",
                      "No" )

    If you want, you can probably combine both into just one column.

    Regards,

5 Replies

  • Hi Saranya_Tamil ,

     

    You need to create a new calculated column and this should hopefully do the job...

     

    S4U Deal = IF('Table'[Name] = "S4U",'Table'[Family],'Table'[Name])
     
    'Table' in the DAX is the name of your Table, let me know if this worked or not. 😊
     
    Many Thanks,
     
    Taylor
     
  • rsbin's avatar
    rsbin
    Community Champion

    Saranya_Tamil ,

    Please try this as a Calculated Column:

    S4UDeal = IF( AND( [Name] <> "S4U", [Family] = "S4U" ), "Yes", "No" )

    Trust this will work for you.

    Regards,

    • Saranya_Tamil's avatar
      Saranya_Tamil
      Frequent Visitor

      Many thanks, but I need the output as below

      DealNameFamilyOutput
      1ERPERPNo
      1S4US4UNo
      1ERPMSNo
      1ERPPSNo
      2ERPERPYes
      2S4US4UYes
      2ERPS4UYes
      2ERPPSYes
      • rsbin's avatar
        rsbin
        Community Champion

        Saranya_Tamil ,

        Add this as a second Calculated Column:

        Output = SWITCH(
                     TRUE(),
                     CALCULATE( SUM([S4UDeal] ),
                          ALLEXCEPT( 'Deals (2)', 'Deals (2)'[Deal] )) > 0, "Yes",
                          "No" )

        If you want, you can probably combine both into just one column.

        Regards,