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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
JGARROD
Helper I
Helper I

Dynamic Date field interacting with a table of data (with specific dates)

Hi I have the following data (sample) actual data includes over 9000 rows:

 

EntityBought IncorporatedRetiredSold
Liquid XR12/05/200013/5/202017/02/202119/02/2021
Gerhold IR12/05/2012   
Toopy FR30/09/200324/12/201925/10/2018 
Dinky CK12/05/2000   
Upward FG18/06/2005  20/01/2020
Justhol DR12/05/2000 24/01/2019 

 

I need my user to be able to select a date in time (any date between 1990 and today) and for powerBI to return the count of status of the assets at that time. 

 

e.g. date chosen : 01/01/2005 - 4 bought / 0 Incorporated/ 0 retired / 0 sold

       date chosen: 10/05/2020 - 3 bought / 2 retired / 1 sold

 

It basically needs to read the date that is closes and has passed and then pull through the status at that time. 

 

 

Id like this to be shown on something simple like a bar chart but again id like this to update when a date is selected via a selection box. 

 

Is this possible and if so how?

 

TIA

12 REPLIES 12
JGARROD
Helper I
Helper I

thanks @johnt75, hwoever this doesnt seem to be working. 

 

I am assuming I should have a date table set up however i am a bit lost as to how all these things interact. - after adding this measure to a visual i am just getting a blank visual. 

 

How should i be connecting the date table to this (if at all?) 

 

thanks 

Yes, you would need a proper date table set up but it does not need to be related to your data table. Can you share a PBIX ?

Sure, i think ive got it working (almost) - im just getting stuck on how to link the date table in to have the change over time across teh X axis. 

thanks

https://www.dropbox.com/s/du23echic96imk5/PowerBI%20Demo%20File.pbix?dl=0

 

Let me know how you get on - 

Using the Day Month Year column is returning too many values, try using the Month Year column instead. You may also want to consider limiting the date range to further reduce the number of data points.

Finally, check out the SQL BI guys' take on how to get a custom date hierarchy to behave like an inbuilt one. https://www.sqlbi.com/articles/creating-a-simpler-and-chart-friendly-date-table-in-power-bi/ 

This is almost there, i am running into an issue where PowerBI seems to be counting null values for the status's - i.e in the first few years there is just a date against some for a 'merged' status however it seem to be counting values for all the other status's aswell.

PowerBI Demo Capture.JPG

 

As you can see there is no date in the columns for here on these specific rows but its counting them still, is there a way to remove this? prehaps a 'countifvalue'?

 

Link to current report - https://www.dropbox.com/s/aeyi9ue3pl4rr7k/PowerBI%20Demo%20File.pbix?dl=0

 

 

The report file you attached doesn't show that, the dates start in 2006

I have just chenged the date range to show the above image, yet still in 2006 the chart doesnt display the correct results 😕 

In each of the measures where you are checking that the primary date for that measure is <= maxDate you need to add a check to make sure that the primary date is not blank.

Also, check the logic on the measures where you are looking at other dates. In the Merger measure you are excluding cases where the Incorporated date is before the merger date, I don't know if that's what you want.

Ok, i iwll have a look thank you. There is not really a eirachy/rules for which dates come before others, in essence i needed powerBI to look across the row per item and check to see:

@ 'Date selected' what is the status of the closes date that has just passed....

but there is no order to which status it could be. i.e. if it is currenlty 'acquired' then it may turn to 'liquidated' or 'merged', likewise if its incorporated it may go stright to merged etc.

johnt75
Super User
Super User

Yes, you can add them all to the same visual, e.g. clustered column chart.

You could use a date slicer to pinpoint a data, you could also put the date on the x-axis of a chart and show changes in numbers over time.

johnt75
Super User
Super User

Create separate measures for each status like 

Bought Measure =
var maxDate = MAX('Date'[Date])
return CALCULATE( COUNTROWS('Table'),
'Table'[Bought] <= maxDate &&
( ISBLANK( 'Table'[Incorporated]) || 'Table'[Incorporated] > maxDate ) &&
( ISBLANK( 'Table'[Retired]) || 'Table'[Retired] > maxDate ) &&
( ISBLANK( 'Table'[Sold]) || 'Table'[Sold] > maxDate )
)

Thank you for your quick reply, if i were to create one of these for each status, would i then be able to add them all to the same visual?

 

Would i then use a date slice to pinpoint a date in time in order to show to desired outcome?

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.