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
DanielRatvai
Frequent Visitor

Retrieving the Column Header that Corresponds with a Matched Value

Hello, 

I need to create a Quality Check reports, which is showing different error messages related to incidents. It should look like the following: (behind every QAx column, we will have different calculations, which will give back a true or false value, like: if the created date is higher than the closed date, then the QA1 should true.)

TICKET_IDQA1QA2QA3QA4QA5QA6
1TRUE   TRUE 
2 TRUE    
3  TRUE   
4   TRUE  
5    TRUE 
6      
7     TRUE


I would like to create a new column (ERROR_CODE) which will list every QA code where the ticket has TRUE value.

 

TICKET_IDQA1QA2QA3QA4QA5QA6ERRORERROR_CODE
1TRUE   TRUE TRUEQA1,QA5
2 TRUE    TRUEQA2
3  TRUE   TRUEQA3
4   TRUE  TRUEQA4
5    TRUE TRUEQA5
6      FALSE 
7     TRUETRUEQA7

Can somebody help me out with this?

Thanks and regards,
Daniel

1 ACCEPTED SOLUTION
v-stephen-msft
Community Support
Community Support

Hi @DanielRatvai ,

 

Agree with @lbendlin . In Power Query, you can use unpivot columns and Text.Combine() to achieve it.

Reference:

Unpivot columns - Power Query | Microsoft Learn

excel - PowerQuery/M: How can I combine text from multiple rows into one row - Stack Overflow

 

   

                                                                                                                                                         

Best Regards,

Stephen Tao

 

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

2 REPLIES 2
v-stephen-msft
Community Support
Community Support

Hi @DanielRatvai ,

 

Agree with @lbendlin . In Power Query, you can use unpivot columns and Text.Combine() to achieve it.

Reference:

Unpivot columns - Power Query | Microsoft Learn

excel - PowerQuery/M: How can I combine text from multiple rows into one row - Stack Overflow

 

   

                                                                                                                                                         

Best Regards,

Stephen Tao

 

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

lbendlin
Super User
Super User

There is no magic to it - DAX does not have a COLUMNNAMES  function (unlike Power Query).  You need to hardwire the logic.

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.

Top Solution Authors