Forum Discussion

edwsmeadmin's avatar
edwsmeadmin
Frequent Visitor
4 years ago
Solved

Using CALCULATETABLE with GROUP BY and IF

So, I have 1 flat file "abc". My business case is, i have to extact 2 table out of "abc". 1st table will be filtered based on "type of trasaction" and "clearance status" 2nd table will be filtered ...
  • edwsmeadmin's avatar
    4 years ago

    I got it to work.
    My first Table Formula: 

    S01 = CALCULATETABLE (
        C0N_R0R_104,
        C0N_R0R_104[I0T_N0E] IN { "A0H""P0C" },
        KEEPFILTERS ( C0R_R0R104[I0T_S0S] IN { "C0R""B0E" } )

    I got it to work.
    My first Table Formula: 

    F0C = CALCULATETABLE (
        C0N_R0R_104,
        C0N_R0R_104[I0T_N0E] IN { "A0H""P0C" },
        KEEPFILTERS ( C0R_R0R104[I0T_S0S] IN { "C0R""B0E" } )

    TABLE 2=  
    CALCULATETABLE(C0N_R0R_104,C0N_R0R_104[R0T_T0E] = "O0C" && C0N_R0R_104[I0T_S0S] = "C0R" )

    SUMMARY = 
    SUMMARIZE(F0C,F0C[LOAN_ID],"A0T",SUM(F0C[I0T]))

    Clear/Pending = 
    CP = IF(RELATED('F0C G0P'[A0T])>='S01'[I0T],"C0R","P0G")