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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
joshua1990
Post Prodigy
Post Prodigy

SWITCH for 2 different date columns

I have a report that displays daily sales. In the sales table, I have two columns with date information.

I would like to have a switch in the report that distinguishes between both perspectives.

What is the most elegant way to achieve this? Field parameters with selected value and USERELATIONSHIP?

2 ACCEPTED SOLUTIONS
speedramps
Super User
Super User

Click here to downlaod a solution from one drive.

Look at the documentation on all pages, on the relationships and inside the dax measures

Please click thumbs up and accept solution button. Thank you

 

Click here 

speedramps_0-1750947316228.png

 

speedramps_1-1750947327562.png

 

View solution in original post

v-sgandrathi
Community Support
Community Support

Hi @joshua1990,

 

Thank you for providing information on your issue. I’ve reviewed your scenario and successfully replicated it using sample data on my end.

I’m sharing the working .pbix file below so you can explore the setup and DAX logic more clearly. Please feel free to open it and review how the relationships and measures are configured:

 

I hope this helps resolve your issue. If you have any questions or need further clarification, I’m happy to help.

If you found this post useful, kindly give it a ‘Kudos’ and mark it as a solution so others facing similar challenges can find it more easily.

Thanks for being part of the Microsoft Community!

View solution in original post

7 REPLIES 7
speedramps
Super User
Super User

Hi @joshua1990 

 

I went to a lot of effort to provide an explanation and example.
Did you try my method?

Please click thumbs up and the [accept as solution] buttons.

It is polite and sensible to thank helpers this way.  😀

rajendraongole1
Super User
Super User

Hi @joshua1990  - You can only have one active relationship to a table at a time, so the second one must stay inactive.

Create a new table (e.g., Like DatePerspective)>>A slicer-friendly column>> A parameter measure: Perspective

Parameter

Create a measure with userrelationship as below:

SalesAmountSelectedDate =
VAR SelectedDateColumn = SELECTEDVALUE('Date Perspective'[Date Perspective])
RETURN
SWITCH(
TRUE(),
SelectedDateColumn = "OrderDate",
CALCULATE(SUM(Sales[SalesAmount])), -- Active relationship
SelectedDateColumn = "DeliveryDate",
CALCULATE(SUM(Sales[SalesAmount]), USERELATIONSHIP(Sales[DeliveryDate], Calendar[Date])),
-- Default fallback
CALCULATE(SUM(Sales[SalesAmount]))
)

 

Hope this works, try and let know.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





v-sgandrathi
Community Support
Community Support

Hi @joshua1990,

 

Thank you for providing information on your issue. I’ve reviewed your scenario and successfully replicated it using sample data on my end.

I’m sharing the working .pbix file below so you can explore the setup and DAX logic more clearly. Please feel free to open it and review how the relationships and measures are configured:

 

I hope this helps resolve your issue. If you have any questions or need further clarification, I’m happy to help.

If you found this post useful, kindly give it a ‘Kudos’ and mark it as a solution so others facing similar challenges can find it more easily.

Thanks for being part of the Microsoft Community!

Hi @joshua1990,

 

Just checking in! We noticed you haven’t responded yet, and we want to make sure your question gets fully resolved.

Let us know if you need any additional support. If the previous answer addressed your concern, feel free to mark it as Accepted and give it a Kudos to help others with similar queries.

 

Thanks again for contributing to the Microsoft Fabric Community!

Hi @joshua1990,

Hope you're doing well!

Just following up to see if the response we shared was helpful. If you have any further questions or need clarification, we’re here to assist.

Thanks for being a part of the Microsoft Fabric Community!

Hi @joshua1990,

 

Following up to see how things are going with your issue. Has the response provided resolved your query? We’d love to know if you need more help or if everything’s working fine now.

 

If resolved, please mark the answer as Accepted and drop a Kudos to guide fellow members.

Thanks for staying active in the Microsoft Fabric Community!

speedramps
Super User
Super User

Click here to downlaod a solution from one drive.

Look at the documentation on all pages, on the relationships and inside the dax measures

Please click thumbs up and accept solution button. Thank you

 

Click here 

speedramps_0-1750947316228.png

 

speedramps_1-1750947327562.png

 

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.

Top Solution Authors