Forum Discussion
DAX Measure
- Anonymous1 year ago
Hi LoganFFS ,
I used some sample data on my side and tried to reproduce the issue, but it's working fine for me. I used following measures.
ClientCategorySum = CALCULATE( SUM('Trades'[adjustedgrossamount]), FILTER( ALLSELECTED('Trades'), 'Trades'[ClientLastName] = SELECTEDVALUE('Trades'[ClientLastName]) && 'Trades'[Category] = SELECTEDVALUE('Trades'[Category]) ) )ClientCategorySumSignFilter = VAR SelectedSign = SELECTEDVALUE(MeasureFilter[Sign]) VAR ClientSum = CALCULATE( SUM('Trades'[adjustedgrossamount]), FILTER( ALLSELECTED('Trades'), 'Trades'[ClientLastName] = SELECTEDVALUE('Trades'[ClientLastName]) && 'Trades'[Category] = SELECTEDVALUE('Trades'[Category]) ) ) RETURN SWITCH( SelectedSign, "Positive", IF(ClientSum > 0, 1, 0), "Negative", IF(ClientSum < 0, 1, 0), 1 )expected output:
Hope this helps. Please reach out for further assistance.
Thank you.
Hi LoganFFS ,
Thank you for reaching out to the Microsoft fabric community forum. Thank you maruthisp for your inputs on this issue.
After thoroughly reviewing the details you provided, I was able to reproduce the scenario, and it worked on my end. I have used sample data on my end and successfully implemented it.
I am including .pbix file for your better understanding, please have a look into it.
Hope this helps. Please reach out for further assistance.
Thank you.
- LoganFFS1 year agoFrequent Visitor
Hi there, sorry for my absence from the forum here. I am not authorized to open a Pbix file on my computer here so is there a way you can provide the measures code written in the response? If you are able to do that it would be hugely appreciated. Thanks and sorry once again for my absence.
- Anonymous1 year agoNot applicable
Hi LoganFFS ,
I used some sample data on my side and tried to reproduce the issue, but it's working fine for me. I used following measures.
ClientCategorySum = CALCULATE( SUM('Trades'[adjustedgrossamount]), FILTER( ALLSELECTED('Trades'), 'Trades'[ClientLastName] = SELECTEDVALUE('Trades'[ClientLastName]) && 'Trades'[Category] = SELECTEDVALUE('Trades'[Category]) ) )ClientCategorySumSignFilter = VAR SelectedSign = SELECTEDVALUE(MeasureFilter[Sign]) VAR ClientSum = CALCULATE( SUM('Trades'[adjustedgrossamount]), FILTER( ALLSELECTED('Trades'), 'Trades'[ClientLastName] = SELECTEDVALUE('Trades'[ClientLastName]) && 'Trades'[Category] = SELECTEDVALUE('Trades'[Category]) ) ) RETURN SWITCH( SelectedSign, "Positive", IF(ClientSum > 0, 1, 0), "Negative", IF(ClientSum < 0, 1, 0), 1 )expected output:
Hope this helps. Please reach out for further assistance.
Thank you.