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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Count values for multiple columns

I think the title is not clear at all. I have to explain my issue.

 

I have a table with few columns (9 in the screenshot below)

erossini_0-1621253786066.png

I have to create a bar chart based on thise data. The problem is based on the logic I want to apply.

If there is a value in qa1_1_2, I want to count towards qa1_1_1 as well. If qa1_1_9 has a value, I want to count towards qa_1_1 to qa_1_9. For example, if a patient takes two doses of a tablet (qa_1_2), obviously it takes also one dose (qa_1_1). So, I want to count both columns in the graph.

 

I hope it is clear what I'm trying to achieve.

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @Anonymous ,

 

You can try to use UnPivot to transform your data like so:

pass Attribute Value
xxx qa1_1_1 1
xxx qa1_1_2 0
xxx qa1_1_3 0
xxx qa1_1_4 0
... ... ...

 

Then, create a measure to count column "Value" for each "pass".

 

Reference: Pivot and Unpivot with Power BI - RADACAD

 

If this is not what you want, please give me more details.

 

 

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

1 REPLY 1
Icey
Community Support
Community Support

Hi @Anonymous ,

 

You can try to use UnPivot to transform your data like so:

pass Attribute Value
xxx qa1_1_1 1
xxx qa1_1_2 0
xxx qa1_1_3 0
xxx qa1_1_4 0
... ... ...

 

Then, create a measure to count column "Value" for each "pass".

 

Reference: Pivot and Unpivot with Power BI - RADACAD

 

If this is not what you want, please give me more details.

 

 

Best Regards,

Icey

 

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

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.