Forum Discussion
Dpit
3 years agoNew Member
dax calculation
Hello I'm contacting you because I can't get a DAX formula related to my needs these my issue : I have, in my datasource 3 columns my table aims to analyze answers to survey questions I hav...
- 3 years ago
If possible, please share your pbix file, otherwise try the following :
AnswerDistribution = VAR SelectedQuestion = 1 -- Replace with the question ID you want to filter VAR SelectedAnswer = "No" -- Replace with the answer you want to filter VAR FilteredPeople = CALCULATETABLE( VALUES('Survey'[ID_PERSON]), 'Survey'[ID_QUESTION] = SelectedQuestion, 'Survey'[ANSWER] = SelectedAnswer ) VAR QuestionToAnalyze = 2 -- Replace with the question ID you want to analyze VAR Result = CALCULATE( COUNT('Survey'[ANSWER]), FilteredPeople, 'Survey'[ID_QUESTION] = QuestionToAnalyze ) RETURN IF(Result > 0, Result / COUNTROWS(FilteredPeople), BLANK())
Dpit
3 years agoNew Member
Sorry for the delay in response, I had to work on another point.
Thank you very much for your proposal which I tried to adapt without success.
But your code gave me an idea to modify the data upstream.
Thank you for your formula that I keep aside for next time, I didn't know we could do so much with dax 🙂