Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi PowerBI Community.
I have a little complex sales-orders and needs some help designing the measure.
I want to create a measure that sums the user price for the order.
If the order contains only "User" - summarize.
If the order contains "Unlimited" i only want that value, and ignore the rest
If the order contains anything else (fx. Company) i want to ignore that one and just summarize the Users.
Order | Item | Price |
1-ord | User | 300 |
1-ord | User | 300 |
2-ord | Unlimited | 5000 |
2-ord | User | 300 |
2-ord | User | 300 |
3-ord | User | 300 |
4-ord | User | 300 |
5-ord | Company | 10000 |
5-ord | User | 300 |
5-ord | User | 300 |
Expected outcome
Order 1: 600
Order 2: 5000
Order 3: 300
Order 4: 300
Order 5: 600
Unsure if this is possible, or if i should maybe add a conditional column so i have only Users and unlimited in a new column, as there are many different variations than "Company" which i want to ignore.
Really hope you can help
Solved! Go to Solution.
Something like this:
[Your measure] =
sumx(
distinct( T[Order] ),
calculate(
switch( true(),
// if all visible items are User -> SUM the price
and(
distinctcount( T[Item] ) = 1,
"user" in distinct( T[Item] ) ),
sum( T[Price] ),
// if one of the items is Unlimited -> get the value for Unlimited
// what happens if there are 2 Unlimited's in the same order?
"unlimited" in distinct(T[Item] ),
calculate(
selectedvalue( T[Price] ),
T[Item] = "unlimited"
),
// if order contains anything else -> SUM the price for User
calculate(
sum( T[price] ),
keepfilters( T[Item] = "user" )
)
)
)
)
Very glad to inform you that it works.
Thank you so much, the help is greatly appreciated.
BR Frederik
Something like this:
[Your measure] =
sumx(
distinct( T[Order] ),
calculate(
switch( true(),
// if all visible items are User -> SUM the price
and(
distinctcount( T[Item] ) = 1,
"user" in distinct( T[Item] ) ),
sum( T[Price] ),
// if one of the items is Unlimited -> get the value for Unlimited
// what happens if there are 2 Unlimited's in the same order?
"unlimited" in distinct(T[Item] ),
calculate(
selectedvalue( T[Price] ),
T[Item] = "unlimited"
),
// if order contains anything else -> SUM the price for User
calculate(
sum( T[price] ),
keepfilters( T[Item] = "user" )
)
)
)
)
Wow, thats a bit more complicated than i would have figured out.
Thanks a lot, I will give it a try.
Luckily, there can't be two unlimited in same order.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
10 | |
10 | |
9 | |
9 |
User | Count |
---|---|
20 | |
13 | |
12 | |
11 | |
8 |