Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Want to swap small price with large price and middle price remain same
Input Table Output
category Sub_Cat Price column
A Small 100 300
A Medium 200 200
A Large 300 100
B Small 200 400
B Medium 300 300
B Large 400 300
Solved! Go to Solution.
Hi, @GirishS3
You can try the following methods.
Measure:
Measure =
Var Large=CALCULATE(MAX('Table'[Price]),ALLEXCEPT('Table','Table'[category]))
Var Small=CALCULATE(MIN('Table'[Price]),ALLEXCEPT('Table','Table'[category]))
Return
SWITCH(TRUE(),
SELECTEDVALUE('Table'[Sub_Cat])="Medium",SUM('Table'[Price]),
SELECTEDVALUE('Table'[Sub_Cat])="Small",Large,
SELECTEDVALUE('Table'[Sub_Cat])="Large",Small )
Column:
Column =
Var Large=CALCULATE(MAX('Table'[Price]),FILTER(ALL('Table'),[category]=EARLIER('Table'[category])))
Var Small=CALCULATE(MIN('Table'[Price]),FILTER(ALL('Table'),[category]=EARLIER('Table'[category])))
Return
SWITCH(TRUE(),
[Sub_Cat]="Medium",[Price],
[Sub_Cat]="Small",Large,
[Sub_Cat]="Large",Small )
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @GirishS3
You can try the following methods.
Measure:
Measure =
Var Large=CALCULATE(MAX('Table'[Price]),ALLEXCEPT('Table','Table'[category]))
Var Small=CALCULATE(MIN('Table'[Price]),ALLEXCEPT('Table','Table'[category]))
Return
SWITCH(TRUE(),
SELECTEDVALUE('Table'[Sub_Cat])="Medium",SUM('Table'[Price]),
SELECTEDVALUE('Table'[Sub_Cat])="Small",Large,
SELECTEDVALUE('Table'[Sub_Cat])="Large",Small )
Column:
Column =
Var Large=CALCULATE(MAX('Table'[Price]),FILTER(ALL('Table'),[category]=EARLIER('Table'[category])))
Var Small=CALCULATE(MIN('Table'[Price]),FILTER(ALL('Table'),[category]=EARLIER('Table'[category])))
Return
SWITCH(TRUE(),
[Sub_Cat]="Medium",[Price],
[Sub_Cat]="Small",Large,
[Sub_Cat]="Large",Small )
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
Use below Code to create a column in your table :
Appreciate your Kudos
@GirishS3
If you need a DAX solution, add the folloiwng Calculated Column to your table as follows
New Price =
VAR __SubC = Table1[Sub_Cat]
RETURN
SWITCH(
TRUE(),
__SubC = "Small",
CALCULATE(
max(Table1[Price]),
Table1[Sub_Cat] = "Large",
ALLEXCEPT(Table1,Table1[Category])
),
__SubC = "Large",
CALCULATE(
max(Table1[Price]),
Table1[Sub_Cat] = "Small",
ALLEXCEPT(Table1,Table1[Category])
),
Table1[Price]
)
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 58 | |
| 53 | |
| 43 | |
| 17 | |
| 16 |
| User | Count |
|---|---|
| 123 | |
| 108 | |
| 44 | |
| 32 | |
| 24 |