Forum Discussion

AllanBerces's avatar
AllanBerces
Post Prodigy
1 year ago
Solved

Sum per Week and Filter

Hi and good day,
Can anyone pls need help on my measure.

Measure1 = Sum per Week per Location
Measure2 = Sum per Code per Week per Location

PLS NOTE: Need to Filter  Type = Indirect

DESIRED OUTPUT in MEASURE

Thank you

 

  • hi AllanBerces 

     

    Please try these:

    Measure1 =
    CALCULATE (
        data[hrs],
        ALLEXCEPT ( data, data[week no], data[location] ),
        KEEPFILTERS ( data[filter type] = "indirect" )
    )
    
    
    Measure1 =
    CALCULATE (
        data[hrs],
        ALLEXCEPT ( data, data[week no], data[location], data[code] ),
        KEEPFILTERS ( data[filter type] = "indirect" )
    )
    

3 Replies

  • hi AllanBerces 

     

    Please try these:

    Measure1 =
    CALCULATE (
        data[hrs],
        ALLEXCEPT ( data, data[week no], data[location] ),
        KEEPFILTERS ( data[filter type] = "indirect" )
    )
    
    
    Measure1 =
    CALCULATE (
        data[hrs],
        ALLEXCEPT ( data, data[week no], data[location], data[code] ),
        KEEPFILTERS ( data[filter type] = "indirect" )
    )
    
  • Hi AllanBerces ,
    You can Implement the following Dax:

    Measure1: Sum per Week per Location

    Measure1 = 
    CALCULATE(
    SUM('Table'[NPHrs]),
    'Table'[Type] = "Indirect"
    )

    Measure2: Sum per Code, Week, and Location

    Measure2 = 
    CALCULATE(
    SUM('Table'[NPHrs]),
    'Table'[Type] = "Indirect",
    ALLEXCEPT('Table', 'Table'[Code], 'Table'[WeekNo], 'Table'[Location])
    )

    Explanation:

    • Measure1:
      Sums up NPHrs for rows where Type is "Indirect".
      Groups the result by Location and WeekNo.
    • Measure2:
      Sums up NPHrs for rows where Type is "Indirect".
      Groups the result by Code, Location, and WeekNo.

    If I have resolved your question, please consider marking my post as a solution. Thank you!