Forum Discussion

nonex18's avatar
nonex18
New Member
4 years ago
Solved

Dax Measure?

Hello!

So I have two tables here one has the Work Request#s 

Work Request#
ADO01
ADO02
ADO03
ADO04
ADO05

The second table suppose to have the work request statuses

Work Request#StatusStatus Count
ADO01TODO0
ADO01In Progress2
ADO01Completed4
ADO01Not Applicable7
ADO02TODO1
ADO02In Progress5
ADO02Completed11
ADO02Not Applicable12
ADO03TODO0
ADO03In Progress5
ADO03Completed12
ADO03Not Applicable8
ADO04TODO0
ADO04In Progress0
ADO04Completed0
ADO04Not Applicable0
ADO05TODO0
ADO05In Progress0
ADO05Completed0
ADO05Not Applicable0

 

So I need help to create a calculated column because the most current status is supposed to be the one with the highest Status count but if it is a new Work Request the default should be TODO but it does not have any status count upon creation. So the results should be like this

Work Request#Status
ADO01Not Applicable
ADO02Completed
ADO03Completed
ADO04TODO
ADO05TODO


Thanks

  • Hi,

    Please check the below picture and the attached pbix file.

    It is for creating a calculated column.

     

     

    Status CC =
    VAR _statuscountmax =
        MAXX ( RELATEDTABLE ( 'Status' ), 'Status'[Status Count] )
    VAR _result =
        MAXX (
            FILTER ( RELATEDTABLE ( 'Status' ), 'Status'[Status Count] = _statuscountmax ),
            'Status'[Status]
        )
    RETURN
        IF ( _statuscountmax = 0, "TODO", _result )
    

1 Reply

  • Hi,

    Please check the below picture and the attached pbix file.

    It is for creating a calculated column.

     

     

    Status CC =
    VAR _statuscountmax =
        MAXX ( RELATEDTABLE ( 'Status' ), 'Status'[Status Count] )
    VAR _result =
        MAXX (
            FILTER ( RELATEDTABLE ( 'Status' ), 'Status'[Status Count] = _statuscountmax ),
            'Status'[Status]
        )
    RETURN
        IF ( _statuscountmax = 0, "TODO", _result )