Forum Discussion
Anonymous
7 years agoNot applicable
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 | X | Y | Length |
| 1 | 0.321 | False | 100 |
| 1 | 0.375 | False | 150 |
| 1 | 0.425 | False | 200 |
| 1 | 0.257 | TRUE | 275 |
| 1 | 0.309 | False | 300 |
| 1 | 0.2948 | False | 125 |
| 1 | 0.2806 | TRUE | 95 |
| 2 | 0.2664 | False | 225 |
| 2 | 0.2522 | False | 205 |
| 2 | 0.238 | False | 210 |
| 2 | 0.2238 | False | 215 |
| 2 | 0.2096 | False | 219 |
| 2 | 0.1954 | False | 224 |
| 3 | 0.1812 | TRUE | 229 |
| 3 | 0.167 | False | 234 |
| 3 | 0.1528 | False | 239 |
| 3 | 0.1386 | False | 243 |
| 3 | 0.1244 | False | 248 |
| 4 | 0.1102 | True | 253 |
| 4 | 0.096 | True | 258 |
| 4 | 0.0818 | True | 262 |
| 4 | 0.0676 | False | 267 |
| 4 | 0.0534 | False | 272 |
| 4 | 0.0392 | False | 277 |
and I would like to know how to create the following grid using DAX
| ID | X | Length |
| 1 | 0.309 | 370 |
| 2 | 0.2664 | - |
| 3 | 0.1244 | 229 |
| 4 | 0.0392 | 773 |
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_MuhammadCommunity 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)
- AnonymousNot applicable
Thanks Zubair for your help, it is really appreciated :)