Forum Discussion

harshadrokade's avatar
harshadrokade
Post Partisan
3 years ago
Solved

Add column values to filter without unpivot

Hi,   I have below table. I want to create a filter that will have values from column Subject1, Subject2 & Subject3. One option is unpivot column Subject1, Subject2 & Subject3 & then use that 'Attr...
  • KNP's avatar
    3 years ago

    Hi harshadrokade

     

    If this student data is your main fact table and not the student dimension, I'm not sure why you wouldn't unpivot the data. Power BI works better with narrow/tall fact tables.

    In saying that, I obviously don't have the complete picture of your data model/requirements. 

     

    Can you provide an example of how you would want the slicer to work? 

    Are you wanting 'between' two values for any of the subject columns?

    How is the 'Student Overall score' calculated?

     

    If you could go down the unpivot path, with the assumptions I've made, I would have thought a data model more like the below would work better for you/be more performant.

     

     

    Then you can achieve something like this... 

     

    See attached example PBIX.

     

  • KNP's avatar
    KNP
    3 years ago

    So, I'm confident that unpivoting is the correct thing to do to the model for both performance and allowing for the simplest measure creation.

    Did you review the PBIX file I attached?

     

    It doesn't matter if the names were to duplicate in the detail table. Incidentally, if you have a student ID column, you wouldn't use the name in the detail table anyway.

    When referencing the student name, it should be done with the column from the student dimension table which only has a single value for every student. Also, I added the overall score to the student dimension so it will not be duplicated. 

     

    Please review the PBIX file I'd attached previously and let me know if there's a reason that this model design won't work with your actual data.