Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
I am working with the following data:
Total Minutes | Zones |
456 | A |
324 | B |
785 | C |
787 | D |
343 | E |
677 | A |
234 | B |
546 | C |
898 | D |
995 | E |
I have created two measures:
ZoneParkingTime (minutes) = SUM('Parking Data'[Total Minutes])
and:
Petrol Price (£) =
IF(
SELECTEDVALUE('Parking Data'[Zones])="A",([ZoneParkingTime (minutes)]*2/60),
IF(
SELECTEDVALUE('Parking Data'[Zones])="B",([ZoneParkingTime (minutes)]*6/60),
IF(
SELECTEDVALUE('Parking Data'[Zones])="C",([ZoneParkingTime (minutes)]*6/60),
IF(
SELECTEDVALUE('Parking Data'[Zones])="D",([ZoneParkingTime (minutes)]*3/60),
IF(
SELECTEDVALUE('Parking Data'[Zones])="E",([ZoneParkingTime (minutes)]*2/60)
)
)
)
)
)
The measure, Petrol Price (£) does not seem to give a total. I obtain the following results:
Does anyone have any idea as to why this may be happening?. I am attaching the file here if you would like to have a play around with it:
https://www.mediafire.com/file/rirkm73zvrnumxf/Conditional_Statement.pbix/file
Thank you,
Solved! Go to Solution.
Hi @HamidBee ,
Sorry deleted the first post as it wasn't giving totals. See below.
Hi @HamidBee ,
Sorry deleted the first post as it wasn't giving totals. See below.
I'd kindly like to ask what the expression "1" in the equation refers to?
Nice. This DAX forumla works. I tried the one that you had deleted. So I was responding to that earlier.
Thanks. I tried this but unfortunately it didn't work.
Make it into a Column instead and drop SELECTEDVALUE from your code.
Unfortunately this one gave me an error.
Was that when making it as a measure or as a column? It'll give that error if you use that code as a measure, but if you create a column instead it should work.
I believe this was what you were referring to:
Petrol_Price (£) = VAR Y= ADDCOLUMNS('Parking Data', "New Formula",
IF(('Parking Data'[Zones])="A",([ZoneParkingTime (minutes)]*2.8/60),
IF(('Parking Data'[Zones])="B",([ZoneParkingTime (minutes)]*6.1/60),
IF(('Parking Data'[Zones])="C",([ZoneParkingTime (minutes)]*6.1/60),
IF(('Parking Data'[Zones])="D",([ZoneParkingTime (minutes)]*3.05/60),0)))))
RETURN SUMX(Y,[Petrol Price (£)])
I had created it as a measure.