Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hello,
I want to use an IF Statement on a text column to return certain values/calculations from another column.
For example,
If Column 'Name' = "New" then Calculate(Total_Value*12) else (Total_Value)
I haven't been able to figure out how to do this.
I tried this but get an error for Max function only accepts a column reference as an argument
Solved! Go to Solution.
@Anonymous , It would be like this:-
Value =
SWITCH (
TRUE (),
MAX ( 'Value Table'[Name] ) = "New", [Total_Value] * 12,
MAX ( 'Value Table'[Name] ) = "Old", [Total_Value] / 12,
[Total Value]
)
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
Hi @Anonymous ,
Ideal code what your trying would be like this:-
Value = IF(MAX('Value Table'[Name])="New",[Total_Value]*12,[Total Value])
I am considering [Total_value] as some already created measure.
Thanks,
Samarth
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
Hi @Samarth_18
Thank you for this, it works perfectly!
One further question if that is ok... is it also possible to have two IF statements in this Measure?
For example -
If Column 'Name' = "New" then Calculate(Total_Value*12)
or
If Column 'Name' = "Old" then Calculate(Total_Value/12)
else (Total_Value)
Thank you for your speedy reply and help 🙂
@Anonymous , It would be like this:-
Value =
SWITCH (
TRUE (),
MAX ( 'Value Table'[Name] ) = "New", [Total_Value] * 12,
MAX ( 'Value Table'[Name] ) = "Old", [Total_Value] / 12,
[Total Value]
)
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
Super @Samarth_18
This works perfect... I must try to learn more about the SWITCH function!
Thank you for your help! 🙂
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 43 | |
| 38 | |
| 34 | |
| 20 | |
| 16 |
| User | Count |
|---|---|
| 66 | |
| 65 | |
| 30 | |
| 26 | |
| 25 |