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!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
Hello,
My software platform is Excel 2016 in Microsoft Professional Plus 2016.
I am using PowerPivot.
CURRENT STATE
OUTPUT
ISSUE
PROBLEM / DESIRED OUTCOME
My know-how is limited.
I've tried using IF in CALCULATE, but I get a logic error message.
I tried creating a helper column converting Departure to number 1 and Connection to number 2, then using the IF within CALCULATE.
Tried using VALUES in the measure.
I'm just hacking away but I can't figure out if it is possible.
Is what I want to do possible? I can provide the file. Your help is greatly appriciated. See also attached pic. Have a great day!
Solved! Go to Solution.
Thanks for the file, it made everything a bit clearer.
First of all, you need to create a new table with the values Arrival, Departure and Connection, you could call it dim_direction:
Link dim_directon to your Pax-table on Pax[Direction]:
Then replace the existing Direction-slicer with a new slicer from dim_direction[Direction]. This new table can be created in the Excel-file and added to the model.
Then you need to rewrite your measure to this:
Ethiopian 80% LF :=
VAR _DaysInSeries = [ET DaysInSeries]
VAR _ET = 270 * 0,8
RETURN
IF (
HASONEVALUE ( dim_direction[Direction] );
SWITCH (
VALUES ( dim_direction[Direction] );
"Departure"; _ET * _DaysInSeries * 0,9;
"Connection"; _ET * _DaysInSeries * 0,1;
"Arrival"; BLANK ()
);
_DaysInSeries * _ET
)
The underscores in the begining of the variable names is just there to make it easier to reckognize the variables in the code. It is also considered best practice not to include table name when referencing a measure. E.g. instead of 'Calendar'[ET DaysInSeries], write just [ET DaysInSeries]. Table names should only be included when referencing a column.
Cheers,
Sturla
If this post helps, then please consider Accepting it as the solution. Kudos are nice too.
Hi @DAXRichArd ,
I don't quite understand what you are trying to do. A sample file/report would be most helpful.
Cheers,
Sturla
Thanks for the file, it made everything a bit clearer.
First of all, you need to create a new table with the values Arrival, Departure and Connection, you could call it dim_direction:
Link dim_directon to your Pax-table on Pax[Direction]:
Then replace the existing Direction-slicer with a new slicer from dim_direction[Direction]. This new table can be created in the Excel-file and added to the model.
Then you need to rewrite your measure to this:
Ethiopian 80% LF :=
VAR _DaysInSeries = [ET DaysInSeries]
VAR _ET = 270 * 0,8
RETURN
IF (
HASONEVALUE ( dim_direction[Direction] );
SWITCH (
VALUES ( dim_direction[Direction] );
"Departure"; _ET * _DaysInSeries * 0,9;
"Connection"; _ET * _DaysInSeries * 0,1;
"Arrival"; BLANK ()
);
_DaysInSeries * _ET
)
The underscores in the begining of the variable names is just there to make it easier to reckognize the variables in the code. It is also considered best practice not to include table name when referencing a measure. E.g. instead of 'Calendar'[ET DaysInSeries], write just [ET DaysInSeries]. Table names should only be included when referencing a column.
Cheers,
Sturla
If this post helps, then please consider Accepting it as the solution. Kudos are nice too.
Thank you! It works. Now I have to reflect on it to understand why it works. I gonna see if I can make is work for my WN 3n6% FY21 measure.
Big Big thank you and I wish I was as smart as you in DAX!