Forum Discussion

8 Replies

  • Can you please provide more information about the DAX code you have written and your desired outcome in Power BI? This will help me better understand what you are trying to achieve and how I can assist you. Meghbajaj, I would appreciate it if you could share more details about your project.

    • Meghbajaj's avatar
      Meghbajaj
      Frequent Visitor

      Hi hummingbird, thanks for your response.
      I am trying to get the Total (Sum) of Salary by Plan Type. Total Salary = Base + Rent + Phone with respect to the Salary Start Date. Through my Dax forumula using Sum/Sumx, I am getting Total Salary = 3750 ie. 1000+1000+1000+200+200+200+50+50+50. However, what i need is 1000+200+50. I hope it makes sense.

  • hi Meghbajaj 

    try to add a column like:

    Total Salary =
    SUMX(
        SUMMARIZE(
            TableName,
            TableName[ID],
            TableName[Salary Start Date],
            TableName[Salary Type]
            TableName[Salary]
        ),
        TableName[Salary]
    )
    • Meghbajaj's avatar
      Meghbajaj
      Frequent Visitor

      Hi FreemanZ, thanks for your reply. Unfortunately this didn't work as a solution to my problem. Is there any other method you can suggest?

       

      • grantsamborn's avatar
        grantsamborn
        Icon for Solution Sage rankSolution Sage

        Have you considered a calculated column?

        cTotal_Salary = 
        VAR _ID = TableName[ID]
        VAR _Date = TableName[Date]
        VAR _Result =
            SUMX(
                FILTER(
                    ALL( TableName ),
                    TableName[ID] = _ID
                        && TableName[Date] = _Date
                ),
                TableName[Salary]
            )
        RETURN
            _Result

        If you use this column in a table or matrix, you might have to adjust the aggregation for the total line.

        Let me know if this helps.

    • smpa01's avatar
      smpa01
      Icon for Community Champion rankCommunity Champion

      Meghbajaj 

      Measure = CALCULATE(SUMX(ALL(tbl[salary]),[salary]),ALL(tbl))