Forum Discussion
ALLSELECTED AND POWER BI FILTER
Hello, I need your help.
I am working on a PowerBI report which is connected to a "live connection" tabular model for which I am using a "Weight_PTF" measure.
This metric uses the ALLSELECTED function to calculate a ratio.
VAR CurrentAssetVal = [SEC_MarketValue_PTF]
VAR ParentAssetVal = CALCULATE ([SEC_MarketValue_PTF], ALLSELECTED ())
VAR RatioToParent = DIVIDE (CurrentAssetVal, ParentAssetVal)
RETURN RatioToParent
This metric works well when we use Excel and users are happy.
The problem comes when I use the indicator in PowerBI.
The trouble is that in my PBI report we have filters and we don't want those filters to affect our metric.
For example, on the visual we want to display a top N but without recalculating the ratio.
Do you have any idea how to bypass filters in Power BI reports?
3 Replies
- MFelix
Super User
Hi Lidou_Cand ,
This depends on the calculation you are doing and the type of filters you apply, in this case you will need to apply an ALL statement to your calculation that way when you do a TOPN the value will not be recalculated.
When using the ALLSELECTED the filter is applied to the selected values this means that if you have a list of 50 customers they are all included in the calculation when you apply a TOP 5 when using the all selected the calculation will only consider the 5 customers and not the 50. Using ALL you will overpass the filter context and return the full column(s).
Be aware that depending on the measure and the context you may need to use a temporary table or similar.
- amitchandak
Super User
Lidou_Cand , you can use all, or disable interactions
https://docs.microsoft.com/en-us/power-bi/create-reports/service-reports-visual-interactions
- AnonymousNot applicable
Hi Lidou_Cand ,
Using ALLSELECTED() function will calculate the filtered table. You may use ALL() function instead.
It's better to share some sample data and expected result if you need help with DAX formula.
Best Regards,
jay