cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
BrandonG
New Member

Daily Inventory Tracking

I am tracking car lot inventory. I have a unique identifier for each car, a date the car entered the lot and a date the car was sold.

 

 Example

Lot NumberNewSold
15986312/15/20221/12/2023
4589657/23/202211/8/2022
8965988/19/20221/6/2022
2563251/7/2023 
5698528/3/20228/29/2022

 

Is there a was to use these 2 dates so can could look back at a date in time and see how many cars were on lot for a specific day.

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

Hi @BrandonG ,

 

You might consider creating an unconnected calendar table for the slicer.

vcgaomsft_0-1675235893349.png

Then create a measure like this:

Number of cars =
VAR _selected_date =
    SELECTEDVALUE ( 'Calendar'[Date] )
VAR _no =
    COUNTROWS (
        FILTER (
            ALL ( 'Table' ),
            'Table'[New] <= _selected_date
                && (
                    'Table'[Sold] > _selected_date
                        || 'Table'[Sold] = BLANK ()
                )
        )
    ) + 0
RETURN
    _no

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

2 REPLIES 2
v-cgao-msft
Community Support
Community Support

Hi @BrandonG ,

 

You might consider creating an unconnected calendar table for the slicer.

vcgaomsft_0-1675235893349.png

Then create a measure like this:

Number of cars =
VAR _selected_date =
    SELECTEDVALUE ( 'Calendar'[Date] )
VAR _no =
    COUNTROWS (
        FILTER (
            ALL ( 'Table' ),
            'Table'[New] <= _selected_date
                && (
                    'Table'[Sold] > _selected_date
                        || 'Table'[Sold] = BLANK ()
                )
        )
    ) + 0
RETURN
    _no

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

How would you do this if you needed that count of vehicles by like make, model, fuel, (basically across many categories), etc.?  I will need to plot this on a chart for every day going back years.  

 

I'm new to Power BI and truly appreciate the help!

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors