Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

wrong grand total using if statements

hello everyone , i need help with this particular problem in which my measure is not giving out the correct grand totals. i have tried so many ways that my novice mind could think of to fix this p...
  • daxer-almighty's avatar
    5 years ago

    It's actually very easy to do.... You just have to calculate the measure row by row over all the combinations of (week_ending_on, workername), which means you have to write the measure using SUMX. Here's something to get you started (but you have to learn more about DAX, I guess):

     

    [Measure] =
    SUMX(
        summarize(
            T[week_ending_on],
            T[workername]
        ),
        // Here, since SUMX is an iterator
        // you'll know that you have a row context
        // in which only one worker and one
        // week_ending_on are visible. Just write
        // the measure with this in mind and it
        // should work... Please learn from https://dax.guide/calculate
        // how CALCULATE interacts with row contexts.
        <your_measure>
    )
  • AlB's avatar
    AlB
    5 years ago

    Anonymous 

    Create a new variable based on the one you already have. See it at work in the attached file.

    new applied hours TOTAL = 
    SUMX (
        SUMMARIZE ( 'table', 'table'[week_ending_on], 'table'[workername] ),
        [new applied hours]
    )

     

    Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.