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

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.

Reply
Anonymous
Not applicable

Counting days of week in different cells

After reading through the community notes, I figured this out. However, wanted to see if there was an more efficient way. Below is an answer to a survey question (what days do you eat burgers?). Data came in Wednesday;Thursday etc. I've split it up in excel. The goal is to have a table that sums up Monday = 1, Tuesday = 2, etc. I anticipate 100's of ID's, so I'm practicing now. I used powerquery to group and then copied pasted to facilitate summarizing. Clunky. PowerBI helped the query, but I could not add the queries up (back to excel). Unclear if all of this can be done in Power BI. First table below are results from 6 people. If I have 350 people...there's got to be a better way to count the days up. Thougths?

 

ID            Q1.1             Q1.2              Q1.3

14WednesdayThursday 
15MondayThursdayFriday
16ThursdayFriday 
17TuesdayThursday 
18TuesdayWednesdayThursday
19WednesdayFriday 

 

Q1.2             Count

Wednesday1
Thursday3
Friday2
2 ACCEPTED SOLUTIONS
parry2k
Super User
Super User

@Anonymous you should unpivot your table

 

- transform data
- select id column
- right-click, unpivot other columns it will add two columns, attribute, and value, rename these as per your requirement
- close and apply

from here everything will be super easy to work with.

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!



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.

View solution in original post

Icey
Community Support
Community Support

Hi @Anonymous ,

 

I create a simple .pbix file, please check if this meet your requirements:

 

1. In Power Query editor, UnPivot.

unpivot.gif

 

2. Close and Apply.

 

3. In Power BI Desktop, enter data.

WeekDay table:

enter data.PNG

 

4. Sort [WeekDay] column by [Order].

sort.jpg

 

5. Create relationship.

re.PNG

 

6. Create a measure.

Count = COUNT('Table'[Value])+0

 

7. Create visuals.

filter.gif

 

BTW, .pbix file attached.

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Icey
Community Support
Community Support

Hi @Anonymous ,

 

I create a simple .pbix file, please check if this meet your requirements:

 

1. In Power Query editor, UnPivot.

unpivot.gif

 

2. Close and Apply.

 

3. In Power BI Desktop, enter data.

WeekDay table:

enter data.PNG

 

4. Sort [WeekDay] column by [Order].

sort.jpg

 

5. Create relationship.

re.PNG

 

6. Create a measure.

Count = COUNT('Table'[Value])+0

 

7. Create visuals.

filter.gif

 

BTW, .pbix file attached.

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Awesome. Works perfectly. Thank you. 

parry2k
Super User
Super User

@Anonymous you should unpivot your table

 

- transform data
- select id column
- right-click, unpivot other columns it will add two columns, attribute, and value, rename these as per your requirement
- close and apply

from here everything will be super easy to work with.

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!



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
Not applicable

Spoiler
Thank you. It's the little things. Appreciate the info. Very beneficial. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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