Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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 Y
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
105 | |
97 | |
80 | |
66 | |
62 |
User | Count |
---|---|
145 | |
111 | |
104 | |
84 | |
64 |