The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hi Experts,
I need to use a filtercondition where I want to show data as below:
Product.ProductName ="Apple"
or
Geography.Region = "US".
I need to create a filter for the same in power bi,but I cant create a filter with "OR".
Can you please suggest, how I can overcome this challenge.
Thanks and Regards,
Tushar Gaurav
Solved! Go to Solution.
Try this measure:
OR Filter =
VAR vFilterTable =
FILTER (
CROSSJOIN ( ALL ( 'Product'[ProductName] ), ALL ( Geography[Region] ) ),
'Product'[ProductName] = "Apple"
|| Geography[Region] = "US"
)
VAR vResult =
CALCULATE ( SUM ( FactTable[Amount] ), KEEPFILTERS ( vFilterTable ) )
RETURN
vResult
https://www.sqlbi.com/articles/specifying-multiple-filter-conditions-in-calculate/
Proud to be a Super User!
The solution @DataInsights offered is excellent, and you can also consider the following solution.
If you want to control the filter, you can create a measure.
Measure =
IF (
OR (
SELECTEDVALUE ( 'Product'[ProductName] ) = "Apple",
SELECTEDVALUE ( 'Geography'[Region] ) = "US"
),
1,
0
)
Then put the measure to the visual filter, and set the condition that the measure is equal to 1.
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi All,
Thanks for your reply.
Your response is really helpfull. 🙂
The solution @DataInsights offered is excellent, and you can also consider the following solution.
If you want to control the filter, you can create a measure.
Measure =
IF (
OR (
SELECTEDVALUE ( 'Product'[ProductName] ) = "Apple",
SELECTEDVALUE ( 'Geography'[Region] ) = "US"
),
1,
0
)
Then put the measure to the visual filter, and set the condition that the measure is equal to 1.
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Try this measure:
OR Filter =
VAR vFilterTable =
FILTER (
CROSSJOIN ( ALL ( 'Product'[ProductName] ), ALL ( Geography[Region] ) ),
'Product'[ProductName] = "Apple"
|| Geography[Region] = "US"
)
VAR vResult =
CALCULATE ( SUM ( FactTable[Amount] ), KEEPFILTERS ( vFilterTable ) )
RETURN
vResult
https://www.sqlbi.com/articles/specifying-multiple-filter-conditions-in-calculate/
Proud to be a Super User!
User | Count |
---|---|
60 | |
55 | |
53 | |
49 | |
30 |
User | Count |
---|---|
179 | |
87 | |
71 | |
48 | |
46 |