Forum Discussion
How to filter on defined groups?
Hi all!,
I have the following topic: I have 3 different groups :
Group A= code 1,2,3,4
Group B = code 2,3,4
Group C = code 3 ,4
Now I would like to establish 1 single filter with Group A, Group B and Group C to sort the data and calculate the amounts correctly. So far I managed to create 3 separate filters for the 3 Groups (but this is not ideal)
I suppose the solution should come from a Parameter function
Does anyone have a hint here?
Many thanks!!
- Anonymous2 years ago
Hi benjiboy007
You can refer to the following sample
Sample data
Set the group as a table, and put the group column to the slicer.
Then create a measure
Measure = CALCULATE ( SUM ( 'Table'[Amount] ), FILTER ( 'Table', [Code] >= MIN ( 'Group'[MinCode] ) && [Code] <= MAX ( 'Group'[MaxCode] ) ) )Output
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.
6 Replies
- IdrissshatilaSuper User
Hello benjiboy007 ,
you mean like using field parameters , check it out https://learn.microsoft.com/en-us/power-bi/create-reports/power-bi-field-parameters
- benjiboy007Frequent Visitor
Hello, thanks for your reply
I would like to avoid the entry of the Parameter in my visual (as my visual in my PBI are already completely stuffed with dates on x-axis). In screensshot below I filter the visual with 3 different filters. I'm looking for a solution in which I only have 1 filter
- IdrissshatilaSuper User
- AnonymousNot applicable
Hi benjiboy007
You can refer to the following sample
Sample data
Set the group as a table, and put the group column to the slicer.
Then create a measure
Measure = CALCULATE ( SUM ( 'Table'[Amount] ), FILTER ( 'Table', [Code] >= MIN ( 'Group'[MinCode] ) && [Code] <= MAX ( 'Group'[MaxCode] ) ) )Output
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.
- benjiboy007Frequent Visitor
That's great, many thanks!