Forum Discussion

dkbbr's avatar
dkbbr
Regular Visitor
2 years ago

Sales total combine.

How you guy's find a combined total sales? I find Total sales for each of them but it's customers and drivers separated. how you combine them. adding new column like "Role" using dax( i don't really need extra column)

DateCustomerPkIdCustomerNameDriverPkidDriverNameSaleAmount
24/01/011001Jhon2001Brain1000
24/01/021002jon2002Brown1250
24/01/021003jin2001Brain4502
24/01/031002jon2003Tom12515
24/01/041001jhon2004Toms1412

 

I wanna look like this after writing DAX :

 

NameRoleSale
JhonCustomer2412
BrainDriver5502
   

3 Replies

  • Hi dkbbr - you can create a new calculated table with combining the sales data for customers and drivers.

     

    CombinedSales =
    UNION(
        SELECTCOLUMNS(
            FILTER('Cmbine', NOT(ISBLANK('Cmbine'[CustomerPkId]))),
            "Name", 'Cmbine'[CustomerName],
            "Role", "Customer",
            "Sale", 'Cmbine'[SaleAmount]
        ),
        SELECTCOLUMNS(
            FILTER('Cmbine', NOT(ISBLANK('Cmbine'[DriverPkid]))),
            "Name", 'Cmbine'[DriverName],
            "Role", "Driver",
            "Sale", 'Cmbine'[SaleAmount]
        )
    )

     

     

     

    Did I answer your question? Mark my post as a solution! This will help others on the forum!
    Appreciate your Kudos!!

    • dkbbr's avatar
      dkbbr
      Regular Visitor

      "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value"?

       

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi dkbbr ,

    Based on the description, rajendraongole1 the response provides the desired results. It should be helpful to you.

    If you have solved the problem, please please consider Accept it as the solution to help the other members find it more quickly.

     

    Best Regards,

    Wisdom Wu