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
Ade1991
Helper I
Helper I

Calculate availability in a date intervalle

Hello,

I make stats for a company that manages billboards.

I have a list of billboards and for each billboard, its date of assembly and disassembly.

I would like to be able to know my faces mounted and existing on December 31st of each year (or another date). This means that at a date X, the billboard is considered to be mounted if X is later than the date of assembly and earlier than the date of disassembly.

 

I would also like to be able to track the evolution of my number of panels over time.

I'm not sure how to proceed? Filters? Measure? Time Intelligence function ?

 

And in your opinion, what would be the best viz?

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @Ade1991 

Based on your description, I create data to reproduce your scenario.

 

Firstly, you can create a date range and a table as follows.

 

Dates = CALENDAR(MIN(Table[Date]),MAX(Table[Date])) 

x1.png

 

Secondly, you may create a measure like below.

 

TotalNumber = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[assembly date]<=MIN('Dates'[Date]) && 'Table'[disassembly date] >= MAX('Dates'[Date

 

 

Result:

cc1.png

If I misunderstand the your thoughts, please show me the sample data and  expected output. I am glad to solve the problem for you.

Best Regards,

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-alq-msft
Community Support
Community Support

Hi, @Ade1991 

Based on your description, I create data to reproduce your scenario.

 

Firstly, you can create a date range and a table as follows.

 

Dates = CALENDAR(MIN(Table[Date]),MAX(Table[Date])) 

x1.png

 

Secondly, you may create a measure like below.

 

TotalNumber = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[assembly date]<=MIN('Dates'[Date]) && 'Table'[disassembly date] >= MAX('Dates'[Date

 

 

Result:

cc1.png

If I misunderstand the your thoughts, please show me the sample data and  expected output. I am glad to solve the problem for you.

Best Regards,

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks, that's exactly my situation.

 

In your formula, how can i add a condition for this formlua

TotalNumber = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[assembly date]<=MIN('Dates'[Date]) && 'Table'[disassembly date] >= MAX('Dates'[Date]

 

where >= MAX (date) or is blank ?

 

Thanks

kentyler
Solution Sage
Solution Sage

I would say the first question is what is called "granularity". When you say "over time" do you want to track your numbers by month, by week, by day ?

A table that had one record for each day each billboard was up would greatly simplify a lot of calculations.
Such a table could be generated from your table listing the start and end date for each billboard in EXCEL or SQL.

A bar chart or a line graph would probably work well to track a number that changes over time. If you want to compare multiple years a line graph might be better, because you could put 2 or 3 lines on it to represent different years.
The calculations should probably be done in measures, except for calculations like the number of days or months the board is up...that would be a good candidate for a calculated column, or for being calculated in the system you have the data in, before you load the data into power bi.
This would be a good conversation for a screen share... as there are a lot of different factors that could come into play. I'm around all day tomorrow, if you're interested. Send me your email and give me a time and I'll email you a zoom invitation 2-3 PST is already taken.

I'm a personal Power BI Trainer . I learn something every time I answer a question





 





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


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.