Forum Discussion
Using Switch to Change ROWS on TABLE from Month to Quarter to Year
Have a little twist I'd like help with:
I want to use the same table and allow a slicer to choose the Period displayed in Months, Quarters, or Year.
Build a Table
with a measure:
I know I can do this with a MATRIX but wanted to avoid the busy cascading views.
Thoughts?
Hi nesselman ,
If I didnt understand wrongly,create a dimension table as below:
Then create a measure as below:
Measure = IF(NOT(ISFILTERED('dim table'[Column1])),BLANK(), SWITCH(SELECTEDVALUE('dim table'[Column1]),1, CALCULATE(SUM('Table'[Opps]),FILTER('Table','Table'[Month day] IN FILTERS('dim table'[Period]))), 2, CALCULATE(SUM('Table'[Opps]),FILTER('Table','Table'[Quarter] IN FILTERS('dim table'[Period]))), 3, CALCULATE(SUM('Table'[Opps]),FILTER('Table','Table'[Year] IN FILTERS('dim table'[Period])))))And you will see:
For the related .pbix file,pls see attached.
Best Regards,
KellyDid I answer your question? Mark my post as a solution!
2 Replies
- lbendlinSuper User
Have you considered using calculation groups for this?
- v-kelly-msftCommunity Support
Hi nesselman ,
If I didnt understand wrongly,create a dimension table as below:
Then create a measure as below:
Measure = IF(NOT(ISFILTERED('dim table'[Column1])),BLANK(), SWITCH(SELECTEDVALUE('dim table'[Column1]),1, CALCULATE(SUM('Table'[Opps]),FILTER('Table','Table'[Month day] IN FILTERS('dim table'[Period]))), 2, CALCULATE(SUM('Table'[Opps]),FILTER('Table','Table'[Quarter] IN FILTERS('dim table'[Period]))), 3, CALCULATE(SUM('Table'[Opps]),FILTER('Table','Table'[Year] IN FILTERS('dim table'[Period])))))And you will see:
For the related .pbix file,pls see attached.
Best Regards,
KellyDid I answer your question? Mark my post as a solution!