Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Conditional Sum

Hi, I have Sales Fact table by date.

on the report I have Total Sales by 'SaleType' as shown in the picture.

and what I need is if SaleType is "Online" , I want to add $0.5 to the Online "Total Sales" row and for all other Sale Types it will be only sum(SalesAmount).

 

  • Hi Anonymous ,

    OK used some slicers

    Sales w Segment Channel Parters = 
    var _CP = If(MAX(Segement[SegmentName])= "Channel Partners", SUM(SalesFact[ Sales])+5000,SUM(SalesFact[ Sales]))
    
    return _CP

    and added 5000 to Channel Partners. The logic is the same.
    Let me know if you have any questions.

    If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
    Nathaniel



     

13 Replies

  • Nathaniel_C's avatar
    Nathaniel_C
    Community Champion
    IF(SalesTypeName = "Online", [TotalSaleAmount] * 1.05, [TotalSalesAmount])

    Hi Anonymous ,

    Try this.
    Let me know if you have any questions.

    If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
    Nathaniel

    • Anonymous's avatar
      Anonymous
      Not applicable

      Nathaniel_C : am getting below message to the Measure.

       

      A single value for column 'SaleTypeName' in table 'SaleType' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.

      • Nathaniel_C's avatar
        Nathaniel_C
        Community Champion

        Hi Anonymous , are you trying to create a measure?