Forum Discussion
DAX Comparison between tables
- 4 years ago
Hi Matas
Pleas etry this codeDocument Count = SUMX ( SUMMARIZE ( 'Raw Data','Raw Data'[REGID], 'Raw Data'[DOCID] ), CALCULATE ( VAR EXTable = FILTER ( 'Raw Data', [CALL_POINT] = "EX02" ) VAR VATable = FILTER ( 'Raw Data', [CALL_POINT] = "VA02" ) VAR T1 = ADDCOLUMNS ( EXTable, "@Rank", RANKX ( EXTable, [Index],, ASC, Dense ) ) VAR T2 = ADDCOLUMNS ( T1, "@Value", VAR CurrentRank = [@Rank] VAR T3 = TOPN ( CurrentRank, VATable, [Index], ASC ) RETURN MAXX ( T3, [VALUE] ) ) VAR T4 = FILTER ( T2, [VALUE] <> [@Value] ) VAR T5 = SELECTCOLUMNS ( T4, "@DOCID", [DOCID] ) RETURN COUNTROWS ( DISTINCT ( T5 ) ) ) )
I hope this will solve your problem
Doc. Count =
VAR EXTable =
FILTER ( Extracted, [CALL_POINT] = "EX02" )
VAR VATable =
FILTER ( Extracted, [CALL_POINT] = "VA02" )
VAR T1 =
ADDCOLUMNS ( EXTable, "@Rank", RANKX ( EXTable, [Index],, ASC, DENSE ) )
VAR T2 =
ADDCOLUMNS (
T1,
"@Value",
VAR CurrentRank = [@Rank]
VAR T3 =
TOPN ( CurrentRank, VATable, [Index], ASC )
RETURN
MAXX ( T3, [VALUE] )
)
VAR T4 =
FILTER ( T2, [VALUE] <> [@Value] )
VAR T5 =
SELECTCOLUMNS ( T4, "@ID", [DOCID] )
RETURN
COUNTROWS ( DISTINCT ( T4 ) )Hi tamerj1 ,
Thank you for your reply. Unfortunately I am getting exactly the same result by applying your new formula:
I am adding my formula for "Extracted" measure, maybe this will help out:
OCR Extracted Ratio = var T1 = VALUES(Table[DOCID]) var T2 = ADDCOLUMNS(T1, "@NumOfBlanks", SUMX(FILTER(CALCULATETABLE(Table), Table[CALL_POINT] = "EX02"), IF (Table[VALUE] <> BLANK(),1) ) ) var T3 = FILTER(T2, [@NumOfBlanks] <> BLANK()) RETURN COUNTROWS(T3) |
If you have any idea of how to optimize your previous measure, I would be grateful.
Regards,
Matas
- tamerj14 years agoCommunity Champion
Is it me who wrote that measure? It ssems that O don't fully understand your requirement for the validation measure. I prefer to connect via teams or zoom perhaps on Monday. It is really difficult in some cases to auther codes without having your hands on the real data.
- Matas4 years agoAdvocate II
Hi tamerj1 ,
Yes, it was you who helped me with this measure as well.
This sounds great, how could we connect via teams? Could you send me a private message?
And sorry that I cannot publish pbix file or show the full data behind it. This is data from the client, so I am not allowed to do so.
Regards,
Matas