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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Alexandra_B
Helper III
Helper III

Select specific date from table

Hello there.


I have a column in my query field that is Date type. How could I create another column to be able to take selected date from first date table into the new column. For example I have date range 01/01/2021 - 30/07/2022. I want to be able to select School time off / half term/ holidays (01/02/09/2021, 25/10/2021-29/10/2021, etc.) If I can do it using measures and not creating a column, that`s ok too, as long as I am able to add multiple date periods.

 

Thank you

1 ACCEPTED SOLUTION

@Alexandra_B , You can use date table and time filter or both date and time table as filter. Assume date filter is all sorted

 

you can add time filter on a time column (have or create like)

 

Time = timevalue([Datetime])

 

calculate(Sum(Table[Value]) , filter(Table, Table[Time]>= time(8,0,0)  && Table[time] >= time(16,0,0) ) )

 

or use time table to

 

https://kohera.be/blog/power-bi/how-to-create-a-time-table-in-power-bi-in-a-few-simple-steps/

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

7 REPLIES 7
Alexandra_B
Helper III
Helper III

I have sorted it out.

Because I didn`t know how to create a table with specific date from another table, I just added two tables (Home - Enter data - table for School term, same for Half term).

Then, I went to Model to create relationship 1-* (see attached).

After that, I created the visuals I needed, with a slicer representing Days of the week, number of days and other required data. (Please note this is just from the data source I have and it is not complete, if you are checking the count of days 😁 )

I still have to work on design and edit some visuals, but at least I reached the main objective.

Thank you @amitchandak for resources!

 

have a wonderful week ahead!

1-* relationship1-* relationshipHalf termHalf termSchool termSchool term

Alexandra_B
Helper III
Helper III

I was thinking maybe I create another table and create a relationship with the main Date table. It is possible to add multiple date range in the new table?

I now I can do like this :

New Date table = calendar(date(25/10/2021), date(29/10/2021))

but can I add in the same calendar  more dates like 20/12/2021 - 04/01/2022, etc?

 

25/10/2021
26/10/2021
27/10/2021
28/10/2021
29/10/2021
20/12/2021
21/12/2021
22/12/2021
04/01/2022
04/04/2022

 

It is possible to create something like this , then create relationship with the main Date column?

Thank you.

amitchandak
Super User
Super User

@Alexandra_B ,
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

refer if this can help

https://community.powerbi.com/t5/Community-Blog/How-to-divide-distribute-values-between-start-date-o...

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Basically I need to calculate data from half hourly fields based on date.
I have created a slicer for days of the week, I will need to calculate the data between 08:00 - 16:00 Mon to Fri for specific dates (when school is open) and then calcuate a different time for the rest of the time.

To calculate the data from 08-16:00 for example I can create a measure to sum the fields, then I can select multiple days from the slicer. I woud like to be somehow able to set another slicer/ measure/ column withdates when schools is open.

@Alexandra_B , You can use date table and time filter or both date and time table as filter. Assume date filter is all sorted

 

you can add time filter on a time column (have or create like)

 

Time = timevalue([Datetime])

 

calculate(Sum(Table[Value]) , filter(Table, Table[Time]>= time(8,0,0)  && Table[time] >= time(16,0,0) ) )

 

or use time table to

 

https://kohera.be/blog/power-bi/how-to-create-a-time-table-in-power-bi-in-a-few-simple-steps/

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Date filter.JPG

 

@Alexandra_B . Sorry not clear to me

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
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!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.