Forum Discussion
markefrody
8 years agoPost Patron
Please Help in Creating DAX Formula
Hi everyone, I am trying to create a DAX formula wherein I need to apply a filter and get total for specified columns in the raw data. Here is what I am trying to accomplish: Filter for Data...
- 8 years ago
Refer to the measure below.
Measure = VAR d = SELECTEDVALUE ( 'Calendar'[Date] ) RETURN DIVIDE ( SUMX ( FILTER ( Table1, ( Table1[Req Date] = d && Table1[Age] IN { 0, 1 } ) || ( Table1[Req Date] = d - 1 && Table1[Age] = 0 ) ), Table1[Count of Load] ), SUMX ( FILTER ( Table1, Table1[Req Date] IN { d, d - 1 } ), Table1[Count of Load] ) )
v-chuncz-msft
8 years agoCommunity Support
You may start from the SELECTEDVALUE Function.
https://www.sqlbi.com/articles/using-the-selectedvalue-function-in-dax/
markefrody
8 years agoPost Patron
Thanks for the link but I am a beginner at writing DAX codes. Will you be able to help me in writing the code as per my specifications above? Appreciate your kind assistance.
- v-chuncz-msft8 years agoCommunity Support
Refer to the measure below.
Measure = VAR d = SELECTEDVALUE ( 'Calendar'[Date] ) RETURN DIVIDE ( SUMX ( FILTER ( Table1, ( Table1[Req Date] = d && Table1[Age] IN { 0, 1 } ) || ( Table1[Req Date] = d - 1 && Table1[Age] = 0 ) ), Table1[Count of Load] ), SUMX ( FILTER ( Table1, Table1[Req Date] IN { d, d - 1 } ), Table1[Count of Load] ) )