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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
GustavoKamchen
Frequent Visitor

Visualize in a view, column value for Nth value in rank

Hello.

I have a list of factory faults caused by production line, and i need to create 3 views (tables) showing which was the fault components and quantities for the 1st, 2nd and 3rd fault reasons, like below:

Visual 1 - Table (Done):
Top 3 fault reasons (last week - date filtered in Visual):

RANKFAULT REASONFAULT QUANTITY
1FAULT 375
2FAULT 283
3FAULT 103

 

View 2 - Table (Pendind):
Components for 1st FAULT REASON (FAULT 37) in the last week (date filtered in visual):

FAULT COMPONENTFAULT QUANTITY
COMPONENT 144
COMPONENT 71

 

View 3 - Table (Pendind):
Components for 2nd FAULT REASON (FAULT 28) in the last week (date filtered in visual):

FAULT COMPONENTFAULT QUANTITY
COMPONENT 82
COMPONENT 151

 

View 4 - Table (Pendind):
Components for 3rd FAULT REASON (FAULT 10) in the last week (date filtered in visual):

FAULT COMPONENTFAULT QUANTITY
COMPONENT 11
COMPONENT 141
COMPONENT 221

 

Note that every week the top 3 FAULT REASONS can change, so I can't filter FAULT REASON directly in the table visual.

How can I create the individual table visuals to show the components for each fault reason? In all visuals, date is filtered in the visual to get only faults that happened in the last calendar week.

Sample data:

DATENOTE NUMBERFAULT REASONCOMPONENTFAULT QUANTITY
6/19/2023100000053FAULT 37COMPONENT 71
6/19/2023100000054FAULT 28COMPONENT 151
6/19/2023100000055FAULT 28COMPONENT 81
6/19/2023100000056FAULT 27COMPONENT 221
6/19/2023100000057FAULT 37COMPONENT 141
6/19/2023100000058FAULT 29COMPONENT 91
6/19/2023100000059FAULT 37COMPONENT 141
6/20/2023100000060FAULT 15COMPONENT 221
6/20/2023100000061FAULT 10COMPONENT 11
6/20/2023100000062FAULT 21COMPONENT 41
6/20/2023100000063FAULT 16COMPONENT 41
6/20/2023100000064FAULT 8COMPONENT 81
6/20/2023100000065FAULT 28COMPONENT 81
6/20/2023100000066FAULT 13COMPONENT 81
6/20/2023100000067FAULT 10COMPONENT 221
6/20/2023100000068FAULT 37COMPONENT 141
6/20/2023100000069FAULT 30COMPONENT 121
6/20/2023100000070FAULT 37COMPONENT 141
6/20/2023100000071FAULT 15COMPONENT 221
6/20/2023100000072FAULT 22COMPONENT 41
6/20/2023100000073FAULT 32COMPONENT 61
6/20/2023100000074FAULT 4COMPONENT 31
6/21/2023100000075FAULT 2COMPONENT 51
6/21/2023100000076FAULT 12COMPONENT 71
6/21/2023100000077FAULT 36COMPONENT 191
6/21/2023100000078FAULT 38COMPONENT 101
6/21/2023100000079FAULT 24COMPONENT 21
6/21/2023100000080FAULT 12COMPONENT 101
6/22/2023100000081FAULT 35COMPONENT 271
6/22/2023100000082FAULT 32COMPONENT 261
6/22/2023100000083FAULT 14COMPONENT 141
6/22/2023100000084FAULT 27COMPONENT 221
6/22/2023100000085FAULT 1COMPONENT 101
6/22/2023100000086FAULT 26COMPONENT 201
6/22/2023100000087FAULT 9COMPONENT 191
6/22/2023100000088FAULT 26COMPONENT 111
6/22/2023100000089FAULT 20COMPONENT 271
6/22/2023100000090FAULT 29COMPONENT 91
6/23/2023100000091FAULT 5COMPONENT 271
6/23/2023100000092FAULT 26COMPONENT 201
6/23/2023100000093FAULT 17COMPONENT 191
6/23/2023100000094FAULT 9COMPONENT 191
6/23/2023100000095FAULT 5COMPONENT 271
6/23/2023100000096FAULT 12COMPONENT 241
6/23/2023100000097FAULT 10COMPONENT 141
1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @GustavoKamchen ,

Here are the steps you can follow:

1. Create calculated column.

Sum_Fault =
COUNTX(
    FILTER(ALL('Table'),
    'Table'[FAULT REASON]=EARLIER('Table'[FAULT REASON])),[FAULT QUANTITY])

Rank =
RANKX(
    ALL('Table'),'Table'[Sum_Fault],,DESC,Dense)

Put it in Visual and set "is less than or equal to" = 3 in Filter

vyangliumsft_0-1688364116929.png

2. Create measure.

Flag_rank1 =
var _rank1=SELECTCOLUMNS(FILTER(ALL('Table'),'Table'[Rank]=1),"1",[FAULT REASON])
var _column=SELECTCOLUMNS(FILTER(ALL('Table'),'Table'[FAULT REASON] in _rank1),"1",[COMPONENT])
return
IF(
    MAX('Table'[COMPONENT]) in _column,1,0)
Flag_rank2 =
var _rank2=SELECTCOLUMNS(FILTER(ALL('Table'),'Table'[Rank]=2),"2",[FAULT REASON])
var _column=SELECTCOLUMNS(FILTER(ALL('Table'),'Table'[FAULT REASON] in _rank2),"2",[COMPONENT])
return
IF(
    MAX('Table'[COMPONENT]) in _column,1,0)
Flag_rank3 =
var _rank1=SELECTCOLUMNS(FILTER(ALL('Table'),'Table'[Rank]=3),"3",[FAULT REASON])
var _column=SELECTCOLUMNS(FILTER(ALL('Table'),'Table'[FAULT REASON] in _rank1),"3",[COMPONENT])
return
IF(
    MAX('Table'[COMPONENT]) in _column,1,0)

3. Place [Flag_rank1], [Flag_rank2], [Flag_rank3] in the corresponding Filter to set is=1.

vyangliumsft_1-1688364177072.png

4. Result:

vyangliumsft_2-1688364177076.png

 

Best Regards,

Liu Yang

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
v-yangliu-msft
Community Support
Community Support

Hi  @GustavoKamchen ,

Here are the steps you can follow:

1. Create calculated column.

Sum_Fault =
COUNTX(
    FILTER(ALL('Table'),
    'Table'[FAULT REASON]=EARLIER('Table'[FAULT REASON])),[FAULT QUANTITY])

Rank =
RANKX(
    ALL('Table'),'Table'[Sum_Fault],,DESC,Dense)

Put it in Visual and set "is less than or equal to" = 3 in Filter

vyangliumsft_0-1688364116929.png

2. Create measure.

Flag_rank1 =
var _rank1=SELECTCOLUMNS(FILTER(ALL('Table'),'Table'[Rank]=1),"1",[FAULT REASON])
var _column=SELECTCOLUMNS(FILTER(ALL('Table'),'Table'[FAULT REASON] in _rank1),"1",[COMPONENT])
return
IF(
    MAX('Table'[COMPONENT]) in _column,1,0)
Flag_rank2 =
var _rank2=SELECTCOLUMNS(FILTER(ALL('Table'),'Table'[Rank]=2),"2",[FAULT REASON])
var _column=SELECTCOLUMNS(FILTER(ALL('Table'),'Table'[FAULT REASON] in _rank2),"2",[COMPONENT])
return
IF(
    MAX('Table'[COMPONENT]) in _column,1,0)
Flag_rank3 =
var _rank1=SELECTCOLUMNS(FILTER(ALL('Table'),'Table'[Rank]=3),"3",[FAULT REASON])
var _column=SELECTCOLUMNS(FILTER(ALL('Table'),'Table'[FAULT REASON] in _rank1),"3",[COMPONENT])
return
IF(
    MAX('Table'[COMPONENT]) in _column,1,0)

3. Place [Flag_rank1], [Flag_rank2], [Flag_rank3] in the corresponding Filter to set is=1.

vyangliumsft_1-1688364177072.png

4. Result:

vyangliumsft_2-1688364177076.png

 

Best Regards,

Liu Yang

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

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.