Forum Discussion

hamoso's avatar
hamoso
New Member
2 years ago
Solved

Create aggregate (AVG, MIN, MAX, SUM, ...) Slicer

Hi guys,   I couldn't find the answer using the search functionality. Therefore I wanted to ask you guys if you could help me with this case.   I have created a matrix table which shows the avera...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi hamoso ,

    The Table data is shown below:

    Please follow these steps:

    1.Create a table and enter the following data manually.

    2.Use the following DAX expression to create a measure

     

    Measure = 
    VAR _a = SELECTEDVALUE('Table 2'[Type])
    VAR _b = IF(_a = "Sum",SUM('Table'[Value]),
                IF(_a = "Average",AVERAGE('Table'[Value]),
                    IF(_a = "Minimum",MIN('Table'[Value]),
                        IF(_a = "Maximum",MAX('Table'[Value]),
                            IF(_a = "Count",COUNT('Table'[Value]))))))
    RETURN _b

     

    3.Final output

     

    Best Regards,
    Wenbin Zhou
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.