Forum Discussion

sarogersz's avatar
sarogersz
Regular Visitor
9 years ago
Solved

(DAX) Problem - Data Profiling Measures

I have a single table, key column is Lot Number.  Each row has a Status column, of which there are 7 Distinct values.  Each Lot is supposed to have a single row with Start of Run status AND a single ...
  • v-jiascu-msft's avatar
    v-jiascu-msft
    9 years ago

    Hi sarogersz,

     

    Maybe your data looks like this:

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    Then you could try these three formulas:

    OnlyHaveStart =
    SUMX (
        SUMMARIZE (
            'Table1',
            'Table1'[Lot Number],
            "IfHit", IF (
                "Start of Run" IN VALUES ( 'Table1'[Status] )
                    && NOT "End of Run" IN VALUES ( 'Table1'[Status] ),
                1,
                0
            )
        ),
        [IfHit]
    )
    OnlyHaveEnd =
    SUMX (
        SUMMARIZE (
            'Table1',
            'Table1'[Lot Number],
            "IfHit", IF (
                NOT "Start of Run" IN VALUES ( 'Table1'[Status] )
                    && "End of Run" IN VALUES ( 'Table1'[Status] ),
                1,
                0
            )
        ),
        [IfHit]
    )
    HaveBoth =
    SUMX (
        SUMMARIZE (
            'Table1',
            'Table1'[Lot Number],
            "IfHit", IF (
                "Start of Run" IN VALUES ( 'Table1'[Status] )
                    && "End of Run" IN VALUES ( 'Table1'[Status] ),
                1,
                0
            )
        ),
        [IfHit]
    )

    Finally you could get the results. Note, pay attention to the fields in the report please. odd result my appear.

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    Best Regards!

    Dale