The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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?
Solved! Go to Solution.
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
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
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. 😀
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.
Proud to be a Super User! | |
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!
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