Forum Discussion
Use parameters to create conditional columns
- 6 years ago
hi Anonymous
You could try this as below:
Step1:
Use What if parameter to create a dynamic value for "65"
https://docs.microsoft.com/en-us/power-bi/desktop-what-if
Step2:
Create a simple Grades table that only contains Grade column
Step3:
Then use adjust the formula that Ashish_Mathur provided.
Measure = VAR _table = ADDCOLUMNS ( Grades, "Lower", IF ( Grades[Grade] = "B", [Parameter Value], SUM(Data[Marks])), "Upper", IF ( Grades[Grade] = "B", 0, [Parameter Value] ) ) RETURN COUNTROWS ( FILTER ( ADDCOLUMNS ( VALUES ( Data[Student] ), "XYZ", CALCULATE ( [Scores], CALCULATETABLE ( VALUES ( Data[Student] ) ), ALLSELECTED () ) ), COUNTROWS ( FILTER ( _table, [Scores]>=[Upper]&&[Scores]<=[Lower] ) ) > 0 ) )here is sample pbix file, please try it.
Regards,
Lin
Consider having 3 technical tables: each holding a range of possible marks for a grade level.
The table for A might hold 50,55,60,65,70,75,80, 85,90
You base a slicer on that table.
the user uses the slicer to select the value they want for "A"
and your DAX code references the technical table to get the value to use to calculate who got an A
same for B and C
- kentyler6 years agoSolution Sage
Let me know if you need help writing the DAX code to figure out what grade users get depending on their score.