Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I have a table that I need pivoted so that I can have all the years in one column and create visualization off of it. Id is the id and year columns are if the id was open during that year.
Id | 2022 | 2021 | 2020 | 2019 | 2018 | 2017 |
1 | Yes | Yes | Yes | No | No | No |
2 | Yes | Yes | No | No | No | No |
3 | Yes | No | No | No | No | No |
4 | No | No | Yes | Yes | Yes | No |
5 | Yes | Yes | No | No | No | No |
6 | No | No | No | Yes | Yes | Yes |
7 | No | No | No | No | Yes | Yes |
8 | No | No | No | No | Yes | Yes |
9 | Yes | Yes | Yes | Yes | Yes | Yes |
Untimately, I want to be able to create a column that just displays year and count of id (that have yes value)
Year | Count |
2022 | 5 |
2021 | 4 |
I can create multiple measures for each calculations to get the results but I want to have a column for each year and create count automatically when I drag ID field in the visualizations.
Solved! Go to Solution.
Hi @bharukc
Yes it can be done using DAX but it shall require some hard coding and the number of coulmns must be fixed. Please follow the same steps in this post. I hope that you don't face any circular dependancy errors given that most of your columns are calculated columns
https://community.powerbi.com/t5/DAX-Commands-and-Tips/Count-Text-in-Columns/m-p/2467106
Hi @bharukc
Yes it can be done using DAX but it shall require some hard coding and the number of coulmns must be fixed. Please follow the same steps in this post. I hope that you don't face any circular dependancy errors given that most of your columns are calculated columns
https://community.powerbi.com/t5/DAX-Commands-and-Tips/Count-Text-in-Columns/m-p/2467106
@bharukc , You can unpivot all the year column in power query , that can help, and then count the number yes or no as per need in a measure
@amitchandak , all these are calculated column using two dates column. Is there a way to do it in dax. As power query editor will not display the calculated columns
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
8 | |
7 | |
6 |
User | Count |
---|---|
14 | |
13 | |
11 | |
9 | |
8 |