Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Suppose I have the following data:
Name | Country | January | February | March | April | May | June | July | August | September | October | November | December |
Alex | USA | 14 | 0 | 74 | 12 | 13 | 98 | 13 | 100 | 18 | 68 | 31 | 35 |
Andrew | USA | 57 | 24 | 67 | 32 | 21 | 37 | 29 | 80 | 54 | 9 | 25 | 34 |
Diego | Spain | 84 | 100 | 52 | 32 | 86 | 11 | 69 | 74 | 77 | 26 | 73 | 85 |
George | Canada | 30 | 95 | 89 | 44 | 85 | 41 | 97 | 38 | 5 | 11 | 59 | 19 |
John | Australia | 47 | 90 | 16 | 55 | 80 | 87 | 98 | 7 | 14 | 79 | 37 | 5 |
Laura | Spain | 66 | 24 | 76 | 82 | 71 | 92 | 59 | 64 | 68 | 78 | 16 | 84 |
Mary | Canada | 14 | 49 | 64 | 44 | 91 | 49 | 96 | 26 | 76 | 25 | 33 | 34 |
Santiago | Spain | 55 | 97 | 32 | 82 | 71 | 88 | 31 | 27 | 89 | 55 | 77 | 5 |
I want to have a slicer with the months of the year, allowing single or multiple segmentation at once. With that I'd like to have a table (or any graphic) that shows the sum of the values for each country, depending on the months selected in the slicer.
For example:
If only January is selected as a filter we would obtain this count: USA - 71, Spain - 205, Canada - 44, Australia - 47. However, if we select from January, February and March in the slicer, we would obtain: USA - 236, Spain - 586, Canada - 341, Australia - 153.
I need help on how to handle this problem, since I don't know how to turn "Months" into a slicer.
Thanks in advance.
Solved! Go to Solution.
Hey @Anonymous ,
you should unpivot the month columns. You can do that like this:
Then you can rename the "Attribute" column to "Date", replace the values with real dates and then you can slice by date in the report.
@Anonymous understood, but as a best practice and a scalable solution, it is always good to have unpivoted data. There is always create a better model or write a complex DAX to achieve the business goal. You decide what to pick. So better to revisit your solution by revisiting that this needs to be unpivoted. All the best.
Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@Anonymous
Dax calculation is based on rows not column, the best solution for is to transform the table making the month into rows then you can create a slicer to filter to interact. If you are worrying about later report creation. You can just duplicate the table then use the new table for this sum calculation.
Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.
@Anonymous
Dax calculation is based on rows not column, the best solution for is to transform the table making the month into rows then you can create a slicer to filter to interact. If you are worrying about later report creation. You can just duplicate the table then use the new table for this sum calculation.
Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.
@Anonymous understood, but as a best practice and a scalable solution, it is always good to have unpivoted data. There is always create a better model or write a complex DAX to achieve the business goal. You decide what to pick. So better to revisit your solution by revisiting that this needs to be unpivoted. All the best.
Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hey @Anonymous ,
you should unpivot the month columns. You can do that like this:
Then you can rename the "Attribute" column to "Date", replace the values with real dates and then you can slice by date in the report.
Hey @selimovd thanks for the help.
I wonder if there is any other alternative to solve this. Since this is a very simplified example of the real data that I'm handling, and the dashboard has many others graphics and variables, I don't know if by "unpivoting" my data, managing the information of the other columns would be more difficult.
@Anonymous you need to unpivot your data in PQ
- transform data
- select name and country columns in the table
- right-click, unpivot other columns it will add two columns, attribute, and value, rename these as per your requirement
- close and apply
Now you can slice the data by months.
Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@parry2k thanks for the response.
Question: this is a simplified example of the real data that I'm handling, and the dashboards has many others graphics and variables. If I unpivot my data wouldn't that make more difficult the ellaboration of my dashboard? Is there any other alternative to the stated problem?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
97 | |
84 | |
67 | |
60 |
User | Count |
---|---|
150 | |
120 | |
99 | |
87 | |
68 |