Forum Discussion

dantheram's avatar
dantheram
Helper II
1 year ago

Removing TOPN DAX

hi how, in paginated report builder, do remove TOPN from -

 

// DAX Query
DEFINE
VAR __DS0FilterTable = 
TREATAS({"In Progress",
"Not Started"}, 'ILR Actions'[Status])
 
VAR __DS0Core = 
SELECTCOLUMNS(
KEEPFILTERS(
FILTER(
KEEPFILTERS(
SUMMARIZECOLUMNS(
ROLLUPADDISSUBTOTAL(
ROLLUPGROUP(
'ILR Actions'[Parent ILR],
'ILR Actions'[Body Plain Text.text],
'User Information List'[Title],
'ILR Actions'[StartDate],
'ILR Actions'[DueDate],
'ILR Actions'[Updates.text]
), "IsGrandTotalRowTotal"
),
__DS0FilterTable,
"OD_Flag", IGNORE('ILR Actions'[OD Flag]),
"CountRowsILR_Actions", COUNTROWS('ILR Actions')
)
),
OR(
OR(
OR(
OR(
OR(
NOT(ISBLANK('ILR Actions'[Parent ILR])),
NOT(ISBLANK('ILR Actions'[Body Plain Text.text]))
),
NOT(ISBLANK('User Information List'[Title]))
),
NOT(ISBLANK('ILR Actions'[StartDate]))
),
NOT(ISBLANK('ILR Actions'[DueDate]))
),
NOT(ISBLANK('ILR Actions'[Updates.text]))
)
)
),
"'ILR Actions'[Parent ILR]", 'ILR Actions'[Parent ILR],
"'ILR Actions'[Body Plain Text.text]", 'ILR Actions'[Body Plain Text.text],
"'User Information List'[Title]", 'User Information List'[Title],
"'ILR Actions'[StartDate]", 'ILR Actions'[StartDate],
"'ILR Actions'[DueDate]", 'ILR Actions'[DueDate],
"'ILR Actions'[Updates.text]", 'ILR Actions'[Updates.text],
"IsGrandTotalRowTotal", [IsGrandTotalRowTotal],
"OD_Flag", [OD_Flag]
)
 
VAR __DS0PrimaryWindowed = 
TOPN(
502,
__DS0Core,
[IsGrandTotalRowTotal],
0,
'ILR Actions'[DueDate],
1,
'ILR Actions'[Parent ILR],
1,
'ILR Actions'[Body Plain Text.text],
1,
'User Information List'[Title],
1,
'ILR Actions'[StartDate],
1,
'ILR Actions'[Updates.text],
1
)
 
VAR __DS0CoreNoInstanceFiltersNoTotals = 
FILTER(KEEPFILTERS(__DS0Core), [IsGrandTotalRowTotal] = FALSE)
 
EVALUATE
GROUPBY(
__DS0CoreNoInstanceFiltersNoTotals,
"MinOD_Flag", MINX(CURRENTGROUP(), [OD_Flag]),
"MaxOD_Flag", MAXX(CURRENTGROUP(), [OD_Flag])
)
 
EVALUATE
__DS0PrimaryWindowed
 
ORDER BY
[IsGrandTotalRowTotal] DESC,
'ILR Actions'[DueDate],
'ILR Actions'[Parent ILR],
'ILR Actions'[Body Plain Text.text],
'User Information List'[Title],
'ILR Actions'[StartDate],
'ILR Actions'[Updates.text]

 

 

cheers

 

1 Reply

  • Hello dantheram,

     

    Can you please try this approach:

    DEFINE
    VAR __DS0FilterTable = 
    TREATAS({"In Progress",
    "Not Started"}, 'ILR Actions'[Status])
     
    VAR __DS0Core = 
    SELECTCOLUMNS(
    KEEPFILTERS(
    FILTER(
    KEEPFILTERS(
    SUMMARIZECOLUMNS(
    ROLLUPADDISSUBTOTAL(
    ROLLUPGROUP(
    'ILR Actions'[Parent ILR],
    'ILR Actions'[Body Plain Text.text],
    'User Information List'[Title],
    'ILR Actions'[StartDate],
    'ILR Actions'[DueDate],
    'ILR Actions'[Updates.text]
    ), "IsGrandTotalRowTotal"
    ),
    __DS0FilterTable,
    "OD_Flag", IGNORE('ILR Actions'[OD Flag]),
    "CountRowsILR_Actions", COUNTROWS('ILR Actions')
    )
    ),
    OR(
    OR(
    OR(
    OR(
    OR(
    NOT(ISBLANK('ILR Actions'[Parent ILR])),
    NOT(ISBLANK('ILR Actions'[Body Plain Text.text]))
    ),
    NOT(ISBLANK('User Information List'[Title]))
    ),
    NOT(ISBLANK('ILR Actions'[StartDate]))
    ),
    NOT(ISBLANK('ILR Actions'[DueDate]))
    ),
    NOT(ISBLANK('ILR Actions'[Updates.text]))
    )
    )
    ),
    "'ILR Actions'[Parent ILR]", 'ILR Actions'[Parent ILR],
    "'ILR Actions'[Body Plain Text.text]", 'ILR Actions'[Body Plain Text.text],
    "'User Information List'[Title]", 'User Information List'[Title],
    "'ILR Actions'[StartDate]", 'ILR Actions'[StartDate],
    "'ILR Actions'[DueDate]", 'ILR Actions'[DueDate],
    "'ILR Actions'[Updates.text]", 'ILR Actions'[Updates.text],
    "IsGrandTotalRowTotal", [IsGrandTotalRowTotal],
    "OD_Flag", [OD_Flag]
    )
    
    VAR __DS0CoreNoInstanceFiltersNoTotals = 
    FILTER(KEEPFILTERS(__DS0Core), [IsGrandTotalRowTotal] = FALSE)
    
    EVALUATE
    GROUPBY(
    __DS0CoreNoInstanceFiltersNoTotals,
    "MinOD_Flag", MINX(CURRENTGROUP(), [OD_Flag]),
    "MaxOD_Flag", MAXX(CURRENTGROUP(), [OD_Flag])
    )
    
    EVALUATE
    __DS0Core
    
    ORDER BY
    [IsGrandTotalRowTotal] DESC,
    'ILR Actions'[DueDate],
    'ILR Actions'[Parent ILR],
    'ILR Actions'[Body Plain Text.text],
    'User Information List'[Title],
    'ILR Actions'[StartDate],
    'ILR Actions'[Updates.text]
    

    Hope this helps.