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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Hasan29
New Member

Status for every Day Power Query

Hi Power BI Experts,

 

I need an advice how to deal with this kind of data. I would like to show how often a vehicle is in maintannce or rented etc. in a timeframe. But my Problem is that I have Start Dates and End Dates. That means for me I can’t simply upload the data and connect it with my Date Table.

 

ID

Status

Start Date

End Date

1

maintenance

01.01.2022

23.03.2022

2

maintenance

06.04.2022

09.04.2022

4

not rented

01.04.2021

03.08.2022

4

rented

04.08.2022

31.12.2022

3

maintenance

08.08.2022

08.09.2022

3

not rented

09.09.2022

31.09.2022

1

rented

24.04.2022

30.08.2022

 

  1. Is there a way to Change the Form of this Data in Power Query? I would then get the Status of each Day and connect the new table with my Date Table. Or combine a Date Table.
  2. Or should I use VBA to change the Data and then upload to Power BI.

 

Thank You!

7 REPLIES 7
Hasan29
New Member

Hi jbwtb,

 

Thank you for your answer. I would like to show the Number of days. And I would need a % of the Number of Days. For example August Number of Days / 31 Days. 

 

The best or easiest way. I dont know what is easier dax or query. 

 

Regards,

Hasan29
New Member

Short Update: The Data looks like this: 

Hasan29_0-1663272083033.png

 

jbwtp
Memorable Member
Memorable Member

Hi @Hasan29,

 

"how often" is this a number of times (regardless of how long) or a number of days (may be as a % to the total days in the timeframe)?

Also do you expect to do it in DAX or using Power Query?

 

Cheers,

John

Hi jbwtb,

 

Thank you for your answer. I would like to show the Number of days. And I would need a % of the Number of Days. For example August Number of Days / 31 Days. 

 

The best or easiest way. I dont know what is easier dax or query. 

 

Regards,

jbwtp
Memorable Member
Memorable Member

Hi @Hasan29 

 

Assuming that we have two tables like this:

Dates

jbwtp_0-1663553556940.png

etc.

 

Items

jbwtp_1-1663553581278.png

 

This is the measure to calcualte % on minatenance, you can create other using this as a template:

 

OnMaintenance = sumx(filter(Items, Items[Status] = "maintenance"), max(0,1+DATEDIFF(max(Items[Start Date], MINX(Dates, [Date])), min(Items[End Date], MAXX(Dates, [Date])), DAY))) / (DATEDIFF(STARTOFMONTH(Dates[Date]), ENDOFMONTH(Dates[Date]), DAY)+1)

 

 

Note that the tables are not linked to each other (i.e. no arrows between them on the relationships view).

 

This is the output view:

jbwtp_2-1663553680762.png

 

P.S. Sorry need to clarify: Month is the date foeld from dates (just grouped):

jbwtp_3-1663553801731.png

 

Kind regards,

John

 

 

 

Hi,

 

thank you for your answer. The formular does not work for me.

After "maintenance") I cant continue the Code with ","  (syntax is incorrect). I have a Date table just like that. 

 

Thank you.

 

Regards,

Hasan

jbwtp
Memorable Member
Memorable Member

Hi Hasan,

 

Sorry, I can't see anything wrong with the formula.

Do you mind sending me a screenshot of the formula that throws the error?

 

Thanks,

John

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.