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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I am working with the following DAX equation. I'd like it to return either "Petrol" or "Diesel" but I'm not sure how to complete the DAX equation after I type 'return'.
Petrol or Diesel = VAR Y = ADDCOLUMNS('Parking Data',"Petrol or Diesel", IF(('Parking Data'[Parking Amount])=[Petrol Price (£)],"Petrol","Diesel"))
RETURN Y
Does anyone have any suggestions?
Solved! Go to Solution.
Hi @HamidBee .
Maybe like this?
Petrol or Diesel = VAR Y = ADDCOLUMNS('Parking Data',"Petrol or Diesel", IF(('Parking Data'[Parking Amount])=[Petrol Price (£)],"Petrol","Diesel"))
RETURN
MAXX ( Y, [Petrol or Diesel])
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
| Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
| Also happily accepting Kudos 🙂 |
| Feel free to connect with me on LinkedIn! | |
| #proudtobeasuperuser | |
Hi @HamidBee .
Maybe like this?
Petrol or Diesel = VAR Y = ADDCOLUMNS('Parking Data',"Petrol or Diesel", IF(('Parking Data'[Parking Amount])=[Petrol Price (£)],"Petrol","Diesel"))
RETURN
MAXX ( Y, [Petrol or Diesel])
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
| Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
| Also happily accepting Kudos 🙂 |
| Feel free to connect with me on LinkedIn! | |
| #proudtobeasuperuser | |
Nice, it worked. I like that 'outside of the box' thinking. I've never actually used the MAXX function before.
Hi @HamidBee,
Would you like to add a new column to an existing table?
If yes, I would just create a calculated column with this:
CalculatedColumn =
IF(('Parking Data'[Parking Amount])=[Petrol Price (£)],"Petrol","Diesel"))
Does this solve your issue? 🙂
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
| Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
| Also happily accepting Kudos 🙂 |
| Feel free to connect with me on LinkedIn! | |
| #proudtobeasuperuser | |
The problem with using that equation is that it gives me the following error:
The syntax for ')' is incorrect. (DAX(IF(('Parking Data'[Parking Amount])=[Petrol Price (£)],"Petrol","Diesel")))).
Hi @HamidBee ,
Are you using "New column"?
You might have clicked on "New measure" instead. Just a wild guess 🙂
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
| Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
| Also happily accepting Kudos 🙂 |
| Feel free to connect with me on LinkedIn! | |
| #proudtobeasuperuser | |
Yes I should have mentioned. I'm trying to create a measure instead of a calculated column. I'm dealing with alot of rows so I'm really trying to avoid using DAX calculated columns. Do you have any ideas on how I could ammend the following:
Petrol or Diesel = VAR Y = ADDCOLUMNS('Parking Data',"Petrol or Diesel", IF(('Parking Data'[Parking Amount])=[Petrol Price (£)],"Petrol","Diesel"))
RETURN YThe Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 59 | |
| 43 | |
| 42 | |
| 23 | |
| 17 |
| User | Count |
|---|---|
| 190 | |
| 122 | |
| 96 | |
| 66 | |
| 47 |