Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have a table with online order data. Here is a sample:
Order_nbr, Item_nbr, channel, prod_cost, prod_cost_packaging
1 , 2 , Pickup , 10 , 0.4
2 , 7 , Delivery, 10 , 0.4
3 , 8 , Vendor , 10 , 0.4
I am creating a metric which will contain prod_cost or prod_cost_packing based on channel, such as for Pickup, it displays prod_cost_packaging, for Delivery, it displays prod_cost and for Vendor, it displays prod_cost_packaing.
I have a slicer on the channel field of the table, I would like to display the sum of all selected channels (whether packaging or prod_cost with respect to channel) for 2 or more selections.
My code (below) works when slicing for 1 channel, but not when I select 2 or more.
var Flowpath_choice = ALLSELECTED(Table[Channel])
return
.
Hi,
I am not sure how your datamodel looks like, but please try something like below.
Expected result measure: =
VAR Flowpath_choice =
SELECTEDVALUE ( Table[Channel] )
RETURN
SWITCH (
TRUE (),
Flowpath_choice IN { "Delivery" }, [Actual Amount],
Flowpath_choice IN { "Pickup", "Vendor" }, [Package Amount],
0
)
This gets rid of the error. But this isn't an actual solution. I have a slicer on the channel field for the table; when I select 2 or more channels, the measure should display the sum of all channel costs (whether packaging or prod_cost). The above solution gets rid of the error but doesn't support the actual multiple selection of the channels.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
18 | |
7 | |
6 | |
5 | |
5 |
User | Count |
---|---|
23 | |
10 | |
10 | |
9 | |
7 |