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
Beho
Helper I
Helper I

Top 2 Failed Categories

Hello,

 

I have a scoring table with multiple categories and I am trying to have visibility on top 2 failed categories per day, month, etc.

 

NameDateCategory 1Category 2 Category 3Category 4Category 5
ABC11/1/2023PassedPassedFailedPassedFailed
DEF21/1/2023FailedPassedFailedFailedFailed
ABC21/1/2023FailedFailedFailedFailedFailed
DEF33/6/2023PassedPassedFailedPassedFailed
ABC33/18/2023FailedFailedPassedFailedFailed
DEF43/18/2023FailedFailedFailedPassedFailed
ABC45/5/2023FailedPassedFailedFailedFailed
DEF55/20/2023PassedPassedFailedPassedFailed
ABC57/18/2023FailedFailedPassedFailedFailed
DEF69/4/2023PassedPassedFailedPassedFailed

 

The only idea I could think of, is to do measures for each categories and sum the daily counts, then compare in another measure. The list I have has over 10 categories, and I am wondering if there is a way to do it in one measure? I am hoping to be able to have a table or chart by month to show the top 2 failing each month for example.

 

6 REPLIES 6
v-zhangti
Community Support
Community Support

Hi, @Beho 

 

You can try the following methods. Check the first two columns-Transform-Unpivot Other column:

vzhangti_0-1699005528358.pngvzhangti_1-1699005542330.png

Date table:

vzhangti_2-1699006882095.png

Measure:

Count = CALCULATE(COUNT('Table'[Name]),FILTER(ALLEXCEPT('Table','Table'[Category]),[Value]="Failed"&&MONTH([Date])=SELECTEDVALUE('Date'[Month])))

vzhangti_3-1699006928535.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

Hi v-zhangti, My issue is the report has a lot of visuals already set up, once I unpivot, the duplicates mess up the numbers.

Can I create another table and somehow have the dates, names, concatenated column, and then split in that table instead. This way it doesn't touch the original table? 

v-zhangti
Community Support
Community Support

Hi, @Beho 

 

Of course. You can copy and paste a copy of your original table in power query. Do the Unpivot operation in the copied data table.

 

Best Regards

Quick question, if I copy the table, does the new table stay updated? I mean if the original table gets new rows or modified rows, does the copy update automatically? Thanks

amitchandak
Super User
Super User

@Beho , If this your source data and the category is on the column, then unpivot it

Unpivot Data(Power Query): https://youtu.be/2HjkBtxSM0g

 

Now you can have measure

M1= countrows(Table)

 

You can use TopN

 

Calculate([M1], keepfilters(topn(2,allselected(Table[Category]), [M1], desc)))

 

or window

 

Calculate([M1], keepfilters(window(1,abs,2,abs,allselected(Table[Category]),orderby( [M1], desc) ))

 

refer

 

Continue to explore Power BI Window function Rolling, Cumulative/Running Total, WTD, MTD, QTD, YTD, FYTD: https://youtu.be/nxc_IWl-tTc
https://medium.com/@amitchandak/power-bi-window-function-3d98a5b0e07f

 

Learn Power BI: Dynamic TOPN using TOPN/Window and Numeric parameter: https://youtu.be/vm2mdEioQPQ

 

TOPN: https://youtu.be/QIVEFp-QiOk
TOPN with Numeric Parameter -https://youtu.be/cN8AO3_vmlY?t=26448

 

 

You might have to switch measures based on view by on selection

 

IsInScope - Switch Rank at different levels: https://youtu.be/kh0gezKICEM

 

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

I tried unpivoting some categories to test, it created a lot of duplicates to my data and it updated all the visuals in my report to the incorrect counts. I will go through the videos, but if it will always create dups, then it would not work.

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.