I have a table (named Proto) in power-bi desktop as shown below (with 4 columns & around 30k rows).
I created a measure with the following DAX code. Here, ProtoVal is a table of single column containing unique values of protocol (like SSL, DNS etc). Based on the user selected protocol, i am filtering the above table to contain rows only for the selected protocol.
ProtoTotBytes =
VAR SelectedProto = SELECTEDVALUE(ProtoVal[Protocol])
VAR temp1 = FILTER(Proto, Proto[Protocol] == SelectedProto)
RETURN CALCULATE(SUM(Proto[total_bytes]), temp1)
The above DAX code works fine. Now in addition to SelectedProto, i wanted to add one more config variable numIP (TopN-IP's being a table of single column containing numerical values 5,10,15,20 etcTopN-IP's = GENERATESERIES(5, 30, 5)
) where i want to take only the top 'numIP' rows from table temp1. Wrote the code below for that. This works whenever i change the value of SelectedProto but doesn't change when i change numIP ? Can anyone please let me know whey its sensitive to one config variable while it is ignoring another ?
ProtoTotBytes =
VAR numIP = SELECTEDVALUE('TopN-IP''s'[TopN-IP's])
VAR SelectedProto = SELECTEDVALUE(ProtoVal[Protocol])
VAR temp1 = FILTER(Proto, Proto[Protocol] == SelectedProto)
VAR temp2 = TOPN(numIP, temp1, [total_bytes], DESC)
RETURN CALCULATE(SUM(Proto[total_bytes]), temp2)