Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi everyone.
I'm want calculate like count if excel in power BI, but my sentence is not ok. I'm try create another measure, but this count all register for each operator.
MeasureCountIf =
CALCULATE (
COUNTROWS ( Table );
FILTER ( Table; Table[Operator] = Table[Operator] );
FILTER ( Table; Table[Serial Number] = Table[Serial Number] )
)
Thanks for help.
HI @andreluizrenda,
Which logic you want to used to link these conditions? AND or OR?
In addition, you can take a look at following formula if it suitable for your requirement:
And Logic = VAR currOpe = SELECTEDVALUE ( Table[Operator] ) VAR currSer = SELECTEDVALUE ( Table[Serial Number] ) RETURN COUNTROWS ( FILTER ( ALLSELECTED ( Table ); Table[Operator] = currOpe && Table[Serial Number] = currSer ) ) Or Logic = VAR currOpe = SELECTEDVALUE ( Table[Operator] ) VAR currSer = SELECTEDVALUE ( Table[Serial Number] ) RETURN COUNTROWS ( FILTER ( ALLSELECTED ( Table ); Table[Operator] = currOpe || Table[Serial Number] = currSer ) )
Regards,
Xiaxoin Sheng
Hello Xiaxoin, thanks for your reply.
I used your solution for AND, but not solve. When i put this measure, not appear all my operator.
Appear only one.
Hi @andreluizrenda,
Is there any summary on your records? AFAIK, SELECTEDVALUE function not works on summary records.
If this is a case, you need to use other functions to get current row contents.
And Logic = VAR currOpe = FIRSTNONBLANK ( Table[Operator]; [Operator] ) VAR currSer = MAX ( Table[Serial Number] ) RETURN COUNTROWS ( FILTER ( ALLSELECTED ( Table ); Table[Operator] = currOpe && Table[Serial Number] = currSer ) ) Or Logic = VAR currOpe = FIRSTNONBLANK ( Table[Operator]; [Operator] ) VAR currSer = MAX ( Table[Serial Number] ) RETURN COUNTROWS ( FILTER ( ALLSELECTED ( Table ); Table[Operator] = currOpe || Table[Serial Number] = currSer ) )
Regards,
Xiaoxin Sheng
User | Count |
---|---|
141 | |
113 | |
104 | |
78 | |
64 |
User | Count |
---|---|
136 | |
125 | |
107 | |
70 | |
61 |