Forum Discussion

tcheong's avatar
tcheong
Frequent Visitor
5 years ago
Solved

Group by different column based on slicer value

Hello, please refer to this pbix for this question.   Background: I have the following data in the 'Products' table: Id CreatedDate Grade ModifiedDate NewGrade 1 10 Nov 2020 A 10 N...
  • tcheong's avatar
    5 years ago

    Hello, I managed to achieve what I needed by creating a measure for each grade like so:

    _ProductCount_GradeA = 
    VAR slicerMaxDate = MAX(DateDim[Date])
    
    RETURN
        CALCULATE(
            COUNT(Products[Id]),
            FILTER(
                ALL(Products[ModifiedDate], Products[Grade], Products[NewGrade]),
                IF(Products[ModifiedDate] <= slicerMaxDate, [NewGrade], [Grade]) = "A"
            )
        ) + 0

     

    You may refer to this PBIX for my solution.

     

    Thanks to everyone who took the time to consider my question. Have a nice day!