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
thank you so much. can you also please show how i can dynamically change my grade threshold ?
- Ashish_Mathur6 years agoSuper User
Hi,
Go to Home > Edit Queries > Click on the Grades Table and double click on Source. Edit the contents of the Table there.
Hope this helps.
- Anonymous6 years agoNot applicable
okay this appears to be a workaround. I also achieved the same with parameters and conditional columns . Unfortunately it is not user friendly as host and expose the URL and end users wont be able to edit the table.
Thank you for the tips.