Forum Discussion

hcze's avatar
hcze
Icon for Helper II rankHelper II
6 years ago
Solved

DAX for column total

Hi,   I want to have the column total as the first column in a matrix but the total does not show up (blank) for some reasons.   As a background, there are three tables involved: TblCategory, Tbl...
  • mahoneypat's avatar
    6 years ago

    Here is how you can do this one.

     

    First, add an index to your TblYear table so you can use it as a Sort By Column to get All Years to show before the years.

     

    Then use this measure.

     

    NewMeasure =
    VAR thisyeartotal =
    SUM ( Facts[Amount] )
    RETURN
    IF (
    ISBLANK ( thisyeartotal ),
    CALCULATE ( SUM ( Facts[Amount] ), ALL ( TblYear ) ),
    thisyeartotal
    )

     

     

    If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

    Regards,

    Pat