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
chalapathy
Frequent Visitor

Get data from production table with dates between first day and last day set by measure

We have our production days from 7:00 AM to 6:59:59 AM the next day and production week starts at Saturday 7:00 AM and goes upto 6:59:59 AM next Saturday. I have set a custom date table  that have date at 7:00 AM and corresponding week number.

I can set measures to First Date and Last date based on week selected. I need to pass these measures to production table and get data between these tables in a tabular list of all items produced during this time period based on user selected Week number. 

How can I set these date measures to filter tble data?

2 REPLIES 2
Stachu
Community Champion
Community Champion

Can you add sample tables (in format that can be copied to PowerBI) from your model with anonymised data? Like this (just copy and paste into the post window).

Column1Column2
A1
B2.5

 

if your production table has dates in the same format as in the date table then you just need a join between the tables on the date column

When you filter for a week it will automatically pass the first&last dates.

If your production table can have different values (e.g. different time) then I can help when you share the tables



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

sturlaws
Resident Rockstar
Resident Rockstar

Hi,

 

So your date table consists of one row pr day, right?

 

How does your data table look like? And what kind of date and time fields does the data table have?

 

If you data table contains something that needs to be summed or counted, you could do something like this:

Measure =
CALCULATE (
    SUM ( Table[Something] );
    FILTER (
        Table;
        Table[DateTime] >= MIN ( dimDate[DateTime] )
            && Table[DateTime] <= MAX ( dimDate[DateTime] )
    )
)

 

But it would probably be a better solution to create a link between you table and data dimension. This you can do by creating a separate date column in you data table, where rows where hours are between 00:00 and 07:00 is given the date of the previous day.

It would be easier to answer you questions if you add sample data or .pbix-file, there is a section about this in the guidelines:
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

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.

Top Solution Authors