Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Creating a new table based on multiple criteria evaluations with DAX

I have a data table and would like to create a new table based on multiple criteria (if it's possible to do this by grouping or modifying the existing table that's fine as well). In the new table I w...
  • v-zhangti's avatar
    4 years ago

    Hi, Anonymous 

     

    You can try the following methods.

    Column =
    VAR _first =
        CALCULATE (
            MIN ( 'Table'[Percentage] ),
            FILTER (
                'Table',
                [Subcategory] = EARLIER ( 'Table'[Subcategory] )
                    && [Attribute] = "First"
                    && [Office] = EARLIER ( 'Table'[Office] )
            )
        )
    VAR _second =
        CALCULATE (
            MIN ( 'Table'[Percentage] ),
            FILTER (
                'Table',
                [Subcategory] = EARLIER ( 'Table'[Subcategory] )
                    && [Attribute] = "Second"
                    && [Office] = EARLIER ( 'Table'[Office] )
            )
        )
    RETURN
        IF ( _first = 0, "N/A", IF ( _second - _first >= 0, "Yes", "No" ) )
    

    Table:

    New table =
    SUMMARIZE ( 'Table', 'Table'[Office], 'Table'[Subcategory], 'Table'[Column] )

    Is this the result you expect?

     

    Best Regards,

    Community Support Team _Charlotte

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