Forum Discussion
theaddies
3 years agoFrequent Visitor
Values function works with separate table but not within same function
I have a table within Power BI that I created using the formula below. top_10_country_list_alternative =
topn(
10,
values(capacity_production_by_plant[Country]),
calculate(sum(capa...
Jihwan_Kim
3 years agoSuper User
Hi,
I am not sure how your datamodel looks like, but please try something like below.
filtered production test =
VAR country_list =
SUMMARIZE (
TOPN (
10,
ALL ( capacity_production_by_plant[Country] ),
CALCULATE (
SUM ( capacity_production_by_plant[production] ),
YEAR ( capacity_production_by_plant[year] ) = 2023
)
),
capacity_production_by_plant[Country]
)
RETURN
SUMX (
FILTER (
capacity_production_by_plant,
capacity_production_by_plant[Country] IN country_list
),
capacity_production_by_plant[production]
)
- theaddies3 years agoFrequent Visitor
I don't get an error from this but it returns the sum of all production for the specfic year ignoring the top_10_country_list.
- Jihwan_Kim3 years agoSuper User
Hi,
Thank you for your message.
Could you please share your sample pbix file's link?