Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hello All.
First off, I am new to power BI, so please bear with me (I am hoping I have included all necessary information).
I have searched to see if there were previous questions asked that are similar to my question but looking at other solutions, these solutions did not seem to fit exactly what I was looking for.
The sample data I am working with is classes, and number of students who attended those classes, and dates attended(screenshot below).
I was wondering if it was possible to group classes together, and then use the group as a slicer.
For example lets say class1 & class2 are math classes, class3 and class4 are history classes, class5 and class6 are science classes.
I would then like to have a filter/slicer with options of math, history, science, so when when I select math, only class1 and class2 data are shown.
I am not sure if what I am wanting to do is possible.
Any help is appreciated.
Thank you in advance.
Solved! Go to Solution.
Hi,
Click on Edit Queries and right click on the first column > Unpivot Other columns. Click on Add Column > Custom column and write this M formula there
=if [Attribute]="class1" or [Attribute]="class2" then "Maths Classes" else if [Attribute]="class3" or [Attribute]="class4" then "History Classes" else "Science classes"
Alternatively, after unpivoting, click on Close and Load. Then go to Data Modelling and write this calculated column formula
=IF(OR([Attribute]="Class1",[Attribute]="Class2"),"Maths Classes",IF(OR([Attribute]="Class3",[Attribute]="Class4"),"History Classes","Science Classes"))
Hope this helps.
Hi,
Click on Edit Queries and right click on the first column > Unpivot Other columns. Click on Add Column > Custom column and write this M formula there
=if [Attribute]="class1" or [Attribute]="class2" then "Maths Classes" else if [Attribute]="class3" or [Attribute]="class4" then "History Classes" else "Science classes"
Alternatively, after unpivoting, click on Close and Load. Then go to Data Modelling and write this calculated column formula
=IF(OR([Attribute]="Class1",[Attribute]="Class2"),"Maths Classes",IF(OR([Attribute]="Class3",[Attribute]="Class4"),"History Classes","Science Classes"))
Hope this helps.
THANK YOU THANK YOU THANK YOU!
This was exactly what I was looking for.
I appreciate your help and walking me through this.
You are welcome.
User | Count |
---|---|
100 | |
87 | |
81 | |
76 | |
71 |
User | Count |
---|---|
112 | |
105 | |
96 | |
74 | |
66 |