Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

DAX Formula Help

Hi 

I am new to DAX and I would like to know how I can fix this

 

I have the following sample dataset 

ID XYLength 
10.321False 100
10.375False 150
10.425False 200
10.257TRUE275
10.309False 300
10.2948False 125
10.2806TRUE95
20.2664False 225
20.2522False 205
20.238False 210
20.2238False 215
20.2096False 219
20.1954False 224
30.1812TRUE229
30.167False 234
30.1528False 239
30.1386False 243
30.1244False 248
40.1102True 253
40.096True 258
40.0818True 262
40.0676False 267
40.0534False 272
40.0392False 277

 and I would like to know how to create the following grid using DAX

ID XLength 
10.309370
20.2664-
30.1244229
40.0392773

 

Mainly what I would like to do to make a grid that has for each ID, the predominant X (X that has the biggest length) and if there are any "True" values in the Y column report the summation length of those True records otherwise report a blank.

  • Anonymous 

     

    You can use these MEASURES

     

    Predominant X =
    CALCULATE (
        MAX ( Table1[X] ),
        FILTER ( table1, Table1[Length] = MAX ( Table1[Length] ) )
    )
    

     

    Length_ = CALCULATE(sum(Table1[Length]),Table1[Y]=true)

     

2 Replies

  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    Community Champion

    Anonymous 

     

    You can use these MEASURES

     

    Predominant X =
    CALCULATE (
        MAX ( Table1[X] ),
        FILTER ( table1, Table1[Length] = MAX ( Table1[Length] ) )
    )
    

     

    Length_ = CALCULATE(sum(Table1[Length]),Table1[Y]=true)

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks Zubair for your help, it is really appreciated :)