Forum Discussion

Sea_and_Anne's avatar
Sea_and_Anne
Helper I
9 years ago
Solved

Top 10 with filter

Hello all,

I have one table with the Machine name , the number of Alarms and the alarm nature. I want to create a simple graph with the top 10 of the machines with the hightest number of alarms.

But some have in name the word "error" , so i want to filter in order to show only the machines that don't contain this word.
So, i have created the top 10 tab. But isn't filter the name...do you know the reason?

 

NewTable = Calculate(TOPN(10,SUMMARIZE(SampleTable,SampleTable[Machine],"TotalAlarms",SUM(SampleTable[Alarms]) )); SampleTable[Machine] <> "% error % ")

 

 

 

MachineAlarmsNature
A14a
A14s
A14f
A14g
B13a
B error13g
D12r
E11t
F error10h
G6w
H5q
I error5a
J4g
K3h
L2t

 

 

 

Thanks in advance for your help

  • Hi, Sea_and_Anne

     

    You can also achieve that in DAX, please refer to the below formula:

     

    NewTable = TOPN(10,SUMMARIZE(FILTER(SampleTable,FIND("error",SampleTable[Machine],1,0)=0),SampleTable[Machine],"TotalAlarms",SUM(SampleTable[Alarms]) ))

     

    Best regards,
    Yuliana Gu

2 Replies

  • v-yulgu-msft's avatar
    v-yulgu-msft
    Microsoft Employee

    Hi, Sea_and_Anne

     

    You can also achieve that in DAX, please refer to the below formula:

     

    NewTable = TOPN(10,SUMMARIZE(FILTER(SampleTable,FIND("error",SampleTable[Machine],1,0)=0),SampleTable[Machine],"TotalAlarms",SUM(SampleTable[Alarms]) ))

     

    Best regards,
    Yuliana Gu

  • Anonymous's avatar
    Anonymous
    Not applicable

    Sea_and_Anne : You can remove rows with Machine having "Error" word in Query Editor. Please screen shot. 

                                   Since you need only Machine and Alarm , remove Nature column . you will get the result.