Forum Discussion

ppraca's avatar
ppraca
Frequent Visitor
2 years ago

Disconnected table alter the filter context

Hi,

I'm working in an Excel Pivot table, and I have a disconnect table: TopN value.

My model:

In the disconnected table I have the following measure: TopN_Value= =SELECTEDVALUE('topN'[TopN value])

In the following filter context everything is ok:

 

But when I drag the TopN_Value measure to the table, it ignore the filter context, and list all the row values for "TARIFA". I think this not happen in Power Bi.

 

 

 

Thanks,

Paulo Praça

 

 

3 Replies

  • ppraca ,You might need to use the CALCULATE function to modify the filter context explicitly. 

     

         TopN_Value = CALCULATE(SELECTEDVALUE('topN'[TopN value]))
    • ppraca's avatar
      ppraca
      Frequent Visitor

      Thanks for your answer, but doesn't work.

  • Hi ppraca As I can understand that, you want to sum the top N value as chosen by the user from the disconnected table. If this is the case, you have to integrate selected value of TopN to your sum measure. Create sum measure to solve the problem :


    SumConsumo =
    VAR TopN_Value = SelectedValue(TopN[TopN_Value])

    VAR _Result = Sumx(TOPN(TopN_Value, YourTable, [Value]), [Value])

    Return
    _Result



    This measure will first select top N value as chosen by the user from the disconnected table, and then sum up the corresponding values. Please adjust the table and column names accordingly.


    Hope this helps!!

    If this solved your problem, please mark it as a solution!!