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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
nelmade
New Member

Using a parameter values in a calculated field

I have 2 field parameters: start_date and end_date:

  • Start_date = {("DE date"NAMEOF('Table'[DE_Date]), 0), ("OE date"NAMEOF('Table'[OE_Date]), 1)}

  • End_date = {("PV date"NAMEOF('Table'[PV_Date]), 0), ("Sold_Date"NAMEOF('Tables'[Sold_Date]), 1)}

 

I want to create a visual showing the datediff between the start and end date depending on the date chosen for each parameter.

Can someone help me with that?

 

Thank you

2 REPLIES 2
amitchandak
Super User
Super User

@nelmade , You need to try measures like

 

Selected Parameter = maxx(filter(Parameter ,Parameter[Parameter Order] = SELECTEDVALUE(Parameter[Parameter Order])), Parameter[Parameter])

 

Datediff =

SWITCH([Selected Parameter]
, "Start Date" ,datediff(Max(Table[Start date]), Today(), Day),
datediff(Max(Table[End Date]), Today(), Day),)

 

 

refer if needed

https://amitchandak.medium.com/switch-topn-with-field-parameters-299a0ae3725f

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

the datediff should include start date and end date : datediff(start_date, end_date, day)

 my data looks like this table below:

OE date

DE date

PV date

Sold date

3/15/2023 

3/15/2023 

3/15/2023 

3/15/2023 

1/25/2023 

1/25/2023 

3/9/2023 

3/14/2023 

3/16/2023 

3/16/2023 

3/16/2023 

3/16/2023 

3/16/2023 

3/16/2023 

3/16/2023 

3/16/2023 

10/3/2022 

10/3/2022 

3/17/2023 

3/18/2023 

2/28/2023 

2/28/2023 

2/28/2023 

3/1/2023 

3/10/2023 

3/10/2023 

3/10/2023 

3/14/2023 


 and i created two fields parameters because i wanted the user to be able to swith between each type of start date and end to calculate the date difference

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.