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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
mussaenda
Super User
Super User

Date Slicer using Calculated Column

I have a date table and my fact table.

My fact table has Due Dates and Posting Dates.

 

I want to have a slicer of dates that will filter the due dates of the table i have.

 

for example:

Slicer date is 31/08/2019

what will show are all the due dates from 31/08/2019 backwards.

I also want to see the delay days. Delay days will be datediff of selected date from slicer and due date

 

Slicer: 31/08/2019

Table:

Doc No. Due Date Delay Days

ABC-01 23/07/2019 39

ABC-02 30/07/2019 32

ABC-03 15/08/2019 16

ABC-04 22/08/2019 9

ABC-05 30/08/2019 1

ABC-06 31/082019 0

 

If I want to go back, like this:

 

Slicer: 20/08/2019

Table:

Doc No. Due Date Delay Days

ABC-01 23/07/2019 28

ABC-02 30/07/2019 21

ABC-03 15/08/2019 5

 

I know this can be done in power bi.

But I don't know how I will connect the date table to the fact table.

I will appreciate any help. Thank you!

 

**********************************

I have posted this one before and was solved using measures.

I am posting again as I am looking for a solution using columns.

2 REPLIES 2
TomMartens
Super User
Super User

Hey @mussaenda ,

 

please be aware that this requirement can not be resolved using calculated columns, this is due to the following:

  • calculated columns will only be "re-calculated" during data refresh
  • the change of a slicer value will not issue a re-calculation of calculated columns

As the value of "Delay Days" depends on a slicer value, this can not be used to as an input for a calculated column.

 

Please describe in more detail why you need this as a calculated column.

My assumption: you want to use "Delay Days" as a slicer or axis.

 

You may consider to provide a pbix file that contains some sample data but still reflects your data model. Upload the pbix to onedrive or dropbox and share the link. If you use and xlsx file to create the sample data, do not forget to upload the xlsx as well.

 

Basically, this kind of requirements can be solved by creating a disconnected table that represents all the possible values of "Delay Days", and some little more complex measures that map for e.g. the "Doc-No" to this disconnected table.

 

Hopefully this provides some additional insights.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Hi @TomMartens,

 

I understand your point. Thank you for explaining clearly.

I am getting frustrated here.

You are right, my plan was to use the delay days as filter.

 

here is the pbix link.

With a little explanation inside.

 

Thank you

 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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