Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

TopN function is not working with parameter

 
I have a parameter in my dashboard for several visuals. For the visuals to be more clear I would like to add a topN. I have this code below, which is working if I add a column name, but is not working if I add the parameter in the underlined part. The parameter is a field parameter created by me. How can I achieve a topN filter for this?
 
topn_Parameter =
 
VAR SelectedTop = SELECTEDVALUE('TopN'[TopN])

RETURN
SWITCH(TRUE(),
    SelectedTop = 0, [TotaleVerkoop],
    RANKX (
            ALLSELECTED(Parameter[Parameter]),
            [TotaleVerkoop]
                )
                  <= SelectedTop,
        [TotaleVerkoop])
 
Kind regards,
 
Pien
Status: Investigating
Comments
Anonymous
Not applicable

Hi @Piend ,

 

Please check if you have met these limits below:

 

  • If there is a tie, in Order_By values, at the N-th row of the table, then all tied rows are returned. Then, when there are ties at the N-th row the function might return more than n rows.

  • If N_Value is 0 (zero) or less, TOPN returns an empty table.

  • TOPN does not guarantee any sort order for the results.

  • This function is not supported for use in DirectQuery mode when used in calculated columns or row-level security (RLS) rules.

 

Best regards.
Community Support Team_ Caitlyn