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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Alvaro_ACP__
Frequent Visitor

Get Column with max value from all of columns

Hi,

 

1. I need to get how many "No Ok" there are of every checkpoint (1 - 12)

2. Then i need to get the worst checkpoint of all (in this case 8, 4, 3...)

3. Later be able to filter by product so i can now which one is the worse of each product.

 

Product/Punto123456789101112
Product 1OkOkOkOkOkOkOkOkOkOkOkOk
Product 2OkOkOkOkOkOkOkOkOkOkOkOk
Product 3OkOkNo OkNo OkOkOkOkNo OkOkOkOkOk
Product 1OkOkOkOkNo OkOkOkOkOkOkOkOk
Product 2OkNo OkOkNo OkOkOkOkNo OkOkOkOkOk
Product 1OkOkOkOkOkOkOkNo OkOkOkOkOk
Product 1OkNo OkOkNo OkOkOkOkNo OkOkOkOkOk
Product 2OkOkNo OkNo OkOkOkOkNo OkOkOkOkOk
Product 1OkOkOkOkOkOkOkOkOkOkOkOk
Product 1OkOkOkOkOkOkOkOkOkOkOkOk
Product 2OkOkOkOkOkOkOkOkOkOkOkOk
Product 2OkOkOkOkOkOkOkOkOkOkOkOk
Product 1OkOkOkOkNo OkOkOkNo OkOkOkOkOk
Product 2OkNo OkOkNo OkNo OkOkOkNo OkOkOkOkNo Ok
Product 2OkN/AN/AN/AOkOkOkN/AOkOkOkOk
Product 3OkOkOkOkOkOkOkOkOkOkOkOk
Product 3OkOkOkOkOkOkOkOkOkOkOkOk
Product 1OkOkOkOkOkOkOkOkOkOkOkOk
Product 3OkOkOkN/AOkOkOkN/AOkOkOkOk
Product 1OkOkOkOkOkOkOkOkOkOkOkOk
Product 3OkNo OkNo OkNo OkNo OkOkOkNo OkOkOkOkN/A
6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

In the Query Editor, select the first column, right click and select "Unpivot Other Columns".  Rename the attribute column to Checkpoint.  Click on Close and Apply.  Create a Table visual and drag the Product column there.  Write these measures

Total = countrows(Data)

Not OK = calculate([Total],Data[Checkpoint]="Not OK")

You may sort the Not OK column in descending order to know the Products with the highest Not Ok cases.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi,

thanks,

when i unpivot the table i loss Columns Headers, i mean, in my table my headers are checkpoint (1, 2, 3,...) when pivoting i lose those headers, and i need them in order to know which one is the worse.
Also if i do it that way i can´t use later filtering (i have more column as region, supervisor, etc..) calc should work so when in visual object i use a filter calc updates.

The header get subsumed into a single Attribute column.  If you have more columns, then select all columns other than the Check point columns and then "Unpivot Other Columns".


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Can you share a couple photos how to do it? i don´t see what you mean

Anonymous
Not applicable

Hi @Alvaro_ACP__ ,

Below is my table:

vxiandatmsft_0-1712712634015.png

The following DAX  might work for you:

Measure = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[1] = "No Ok"))

The final output is shown in the following figure:

vxiandatmsft_1-1712712687521.png

Best Regards,

Xianda Tang

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

Hi,

thanks.

doing it this why it means i will have to make as many measures as columns i need to calculate (in my over 160 checkpoints) and also i need to order them in a table (or something similar) in order to get the 5 top worse of them.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.