Forum Discussion

shaildesai's avatar
shaildesai
Frequent Visitor
4 years ago
Solved

Top N Function

I used Top N and passed a measure (selected value of a slicer of 1 to 10 values) as the first parameter to make it dynamic. But it is returning no records and showing blank. Any help?

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi shaildesai,

    AFAIK, selectedvalue function is used to get the current selection value, it does not work for multiple selected values. If you need to handle multiple/not selections, I think you need to add the 'alternate Result' parameter in your function to handle multiple values scenarios.

    SELECTEDVALUE function - DAX | Microsoft Docs

    In addition, current power bi does not support creating dynamic calculated column/table based on filter/slicer selections, they are working on different data levels and you can use child level to affect its parent. I'd like to suggest you use the query parameter and convert it to a table, then you can extract value from that table for expression calculations.

    Notice: the data level of power bi.

    Database(external) -> query table(query, custom function, query parameters) -> data model table(table, calculate column/table) -> data view with virtual tables(measure, visual, filter, slicer)

    Regards,

    Xiaoxin Sheng

4 Replies