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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
AnshulGupta
Helper I
Helper I

Switch between two date columns based on a slicer

I have a table with two date columns, one for "sale date" and another for product usage as "product start date". 
I have several plots/tables nicely arranged but I have to duplicate each page based on whether I am looking for "sales date" or "product start date". This is creating un-necessary page/tabs. Not to mention I have several calculations going on based on each of these date type, so they too are getting duplicated.

I tried every possible way to have a slicer to switch between "sales date" and "product start date" but failed.
It would have worked nicely if "SELECTEDVALUE" function worked with "CALCULATED COLUMN" as then I could have just created a column based on the selected slicer and all calculations/pages would just be based on this one "CALCULATED COLUMN"

Tried to search all over but it seems most places they say, no solution. I am hoping to be wrong. One such depressing post was below:
https://community.powerbi.com/t5/Desktop/Toggle-between-fiscal-and-calendar-year-using-slicer/m-p/77...

 

6 REPLIES 6
mohammedadnant
Impactful Individual
Impactful Individual

@AnshulGupta 

 

Good day,

Try this.. 

1. Create a disconnected table with only two values 1. Sales Date & 2. Product Start Date (no need to create any relationship with any other tables)

2. Add this as slicer in your report

3. Create measures, in measure use if (selectedvalue(slicer)="SalesDate" , use sales date, use product start date)

 

Hope this will help.

 

Thanks & Regards,

Mohammed Adnan

www.youtube.com/taik18

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

Thanks & Regards,
Mohammed Adnan
Learn Power BI: https://www.youtube.com/c/taik18

I already tried this. Unfortunately, measure doesn't let use the column as it is. But may be I am getting it wrong. So, please tell me exact DAX command for your step 3.

Hi @AnshulGupta

Pls send me the column what you have written for now.

Thanks & Regards,

Mohammed Adnan

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

Thanks & Regards,
Mohammed Adnan
Learn Power BI: https://www.youtube.com/c/taik18

I am afraid you are asking me something which actually I am seeking help for.

I do not yet know how to tag a column out of a slicer selection. It only seems to work for a measure.

Again, my need is, if slicer selection is "sales date", then for any further work "sales date" column should be used. And if slicer selection is "start date", then for any further work "start date" column should be used. Please send me DAX program for the same. Appreciate that.

Hi @AnshulGupta ,

 

There are some posts about dynamic change in x axis. Not the same, but may help:

Dynamic change in X Axis;

Dynamic Attributes In A Power BI Report.

 

 

Best regards

Icey

 

If this post helps, then consider Accepting it as the solution to help other members find it faster.

Thank you. I actually thought about these possibilities but this requires me to duplicate the entire data. Unfortunately, my data is not small within single tables. I have more than 100k rows, many tables and each with 20-30 columns. So, duplicating the dataset would make it unmanageable. Thank you for reminding me of this possibility though.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors