Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hey everyone.
Is there a way, to input column in filter function?
Here is an example:
var x = values(Here comes a calculated column filter by other measurement condition) return calculate(sum(sales[price]);filter(sales;[product]=x)
So in var x i get list of product names which are filtered by other measure. In return i want to get all products, which are in var x.
Thank you
Solved! Go to Solution.
Hi @matemusic,
As we can define variables with both scalar values and tables, you should be able to define an expression like the following one in your scenario.
[RedSales] :=
VAR RedProducts =
FILTER ( ALL ( Product[Color] ), Product[Color] = "Red" )
RETURN
CALCULATE ( SUM ( Sales[Quantity] ), RedProducts )
In addition, here is a good article about Variables in DAX for your reference.
Regards
Hi @matemusic,
As we can define variables with both scalar values and tables, you should be able to define an expression like the following one in your scenario.
[RedSales] :=
VAR RedProducts =
FILTER ( ALL ( Product[Color] ), Product[Color] = "Red" )
RETURN
CALCULATE ( SUM ( Sales[Quantity] ), RedProducts )
In addition, here is a good article about Variables in DAX for your reference.
Regards
Without ever having done it, I bet you can create a variable that returns a table and then pass that into your measure
var x = FILTER( VALUES(Products), [Measure])
RETURN
CALCULATE( SUM(Sales[Price]), x)
I'm not 100% sure if this is what you're asking for but let me know if it works 🙂
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
101 | |
75 | |
63 | |
62 |
User | Count |
---|---|
141 | |
104 | |
101 | |
80 | |
67 |