Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Split table into columns based on unique values

Hi guys,

 

I'd like to split this dummy table into several columns and populate with 1's and 0's, based on the unique values in the Year/Qtr column.

 

Current layout

NameYear/Qtr
Dave2021Q1
John2021Q1
John2021Q2
Patricia2021Q3
Patricia2021Q4
Claire2022Q1
Dave2022Q2
Claire2022Q3
Claire2022Q4

 

Desired layout

Name2021Q12021Q22021Q32021Q42022Q12022Q22022Q32022Q4
Dave1----1--
John11------
Patricia--11----
Claire----1-11

 

or

 

Name2021Q12021Q22021Q32021Q42022Q12022Q22022Q32022Q4
Dave1----1--
John11------
John11------
Patricia--11----
Patricia--11----
Claire----1-11
Dave1----1--
Claire----1-11
Claire----1-11

 

The only difference in the two is that the second desired layout uses the same rows as the current layout.

 

What's key here is that I need it to create columns based on unique values, hence no hardcoding of columns as that would force me to re-code the query as soon as a new quarter starts.

 

Thank you so much for the help!

1 REPLY 1
BA_Pete
Super User
Super User

Hi @Anonymous ,

 

Create a new measure like this:

_countName = DISTINCTCOUNT(yourTable[Name])

 

Then put it all into a matrix visual like this:

BA_Pete_0-1676370561586.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.