Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Win a FREE 3 Day Ticket to FabCon Vienna. Apply now

Reply
kristi_in_heels
Helper II
Helper II

If then DAX help

Hello,

 

I have a number of different sheets, with date columns. I am trying to create a card visual which will pull 2 relevant dates based on the project phase, and then a calculation between the two.

 

Result 1 (Card 1)

If 'All Projects' [ProjectPhaseDescription] = "execution", then return date listed in 'All Projects' [ExecutionStartDate_Actual]

or

If 'All Projects' [ProjectPhaseDescription] = "Prefeasibility", then return date listed in 'All Projects' [PrefeasibilityStartDate_Actual]

or

If 'All Projects' [ProjectPhaseDescription] = "Feasibility", then return date listed in 'All Projects' [FeasibilityStartDate_Actual]

 

Result 2 (Card 2)

If 'All Projects' [ProjectPhaseDescription] = "execution", then return date listed in 'BudgetDates' [EXE]

or

If 'All Projects' [ProjectPhaseDescription] = "Prefeasibility", then return date listed in 'BudgetDates' [PFS]

or

If 'All Projects' [ProjectPhaseDescription] = "Feasibility", then return date listed in 'BudgetDates' [FS]

 

Calculation (Card 3)

Result 2 - Result 1 = # Days

 

Any assistance would be appreciated

 

1 ACCEPTED SOLUTION
devesh_gupta
Impactful Individual
Impactful Individual

@kristi_in_heels  You can create DAX measures which uses Switch function for the above mentioned conditions by you.

 

Result 1 (Card 1):

Result1 =
VAR PhaseDescription = SELECTEDVALUE('All Projects'[ProjectPhaseDescription])
RETURN
SWITCH (
TRUE (),
PhaseDescription = "execution", SELECTEDVALUE('All Projects'[ExecutionStartDate_Actual]),
PhaseDescription = "Prefeasibility", SELECTEDVALUE('All Projects'[PrefeasibilityStartDate_Actual]),
PhaseDescription = "Feasibility", SELECTEDVALUE('All Projects'[FeasibilityStartDate_Actual]),
BLANK ()
)

 

Result 2 (Card 2):

Result2 =
VAR PhaseDescription = SELECTEDVALUE('All Projects'[ProjectPhaseDescription])
RETURN
SWITCH (
TRUE (),
PhaseDescription = "execution", SELECTEDVALUE('BudgetDates'[EXE]),
PhaseDescription = "Prefeasibility", SELECTEDVALUE('BudgetDates'[PFS]),
PhaseDescription = "Feasibility", SELECTEDVALUE('BudgetDates'[FS]),
BLANK ()
)

 

Calculation (Card 3):

Calculation = [Result2] - [Result1]

 

 

Try this if it helps.

 

View solution in original post

4 REPLIES 4
Tahreem24
Super User
Super User

@kristi_in_heels 

Result 1 = SWITCH(TRUE(),

                               All Projects [ProjectPhaseDescription] = "execution", All Projects' [ExecutionStartDate_Actual],

                               All Projects [ProjectPhaseDescription] = "Prefeasibility",  'All Projects' [PrefeasibilityStartDate_Actual],

                                'All Projects' [ProjectPhaseDescription] = "Feasibility", 

'All Projects' [FeasibilityStartDate_Actual])

 

Result 2 = SWITCH(TRUE(),

                               All Projects [ProjectPhaseDescription] = "execution",'BudgetDates' [EXE],

                               All Projects [ProjectPhaseDescription] = "Prefeasibility", 'BudgetDates' [PFS],

                                'All Projects' [ProjectPhaseDescription] = "Feasibility",  'BudgetDates' [FS])

 

CARD 3 = DATEDIFF(Result2, Result 1, DAYS)

 

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

Thank you for taking the time to respond. I saw the other reply before yours and that worked perfectly so I didn't apply your option. I appreciate your help though.

devesh_gupta
Impactful Individual
Impactful Individual

@kristi_in_heels  You can create DAX measures which uses Switch function for the above mentioned conditions by you.

 

Result 1 (Card 1):

Result1 =
VAR PhaseDescription = SELECTEDVALUE('All Projects'[ProjectPhaseDescription])
RETURN
SWITCH (
TRUE (),
PhaseDescription = "execution", SELECTEDVALUE('All Projects'[ExecutionStartDate_Actual]),
PhaseDescription = "Prefeasibility", SELECTEDVALUE('All Projects'[PrefeasibilityStartDate_Actual]),
PhaseDescription = "Feasibility", SELECTEDVALUE('All Projects'[FeasibilityStartDate_Actual]),
BLANK ()
)

 

Result 2 (Card 2):

Result2 =
VAR PhaseDescription = SELECTEDVALUE('All Projects'[ProjectPhaseDescription])
RETURN
SWITCH (
TRUE (),
PhaseDescription = "execution", SELECTEDVALUE('BudgetDates'[EXE]),
PhaseDescription = "Prefeasibility", SELECTEDVALUE('BudgetDates'[PFS]),
PhaseDescription = "Feasibility", SELECTEDVALUE('BudgetDates'[FS]),
BLANK ()
)

 

Calculation (Card 3):

Calculation = [Result2] - [Result1]

 

 

Try this if it helps.

 

Thank you, this worked perfectly. I really appreciate your assistance.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.