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
Ritaf
Responsive Resident
Responsive Resident

New items from start of year

Hi,

I have a table of cars that we own at our fleet vehicles, every month, a part of cars are replaced by new and we purchasing new cars also. The table of cars seems like a table below. How can I calculate the new cars that we owning by the granularity of the month and year?  (The model have a date table with the active relationship "by date of the report" because of other measures, so the calculation have to deal with use relationship or another solution too) . Thank you, Rita

date of reportdate of purchasecar id
01/01/202001/12/20191111
01/02/202001/01/20205555
01/03/202001/01/2020666
1 ACCEPTED SOLUTION
gdarakji
Resolver III
Resolver III

You need to create an inactive relationship between the date table and "Date of purchase". After that, you can write the following measure to get the count:
CountOfPurchasedCars = CALCULATE(COUNT(Cars[Car id]),USERELATIONSHIP(Dates[Date],Cars[date of purchase]))

 

Note that I assumed the name of the table you posted is "Cars" and your dates table is called "Dates". Please update those in the measure if my assumptions are not correct.

View solution in original post

3 REPLIES 3
gdarakji
Resolver III
Resolver III

You need to create an inactive relationship between the date table and "Date of purchase". After that, you can write the following measure to get the count:
CountOfPurchasedCars = CALCULATE(COUNT(Cars[Car id]),USERELATIONSHIP(Dates[Date],Cars[date of purchase]))

 

Note that I assumed the name of the table you posted is "Cars" and your dates table is called "Dates". Please update those in the measure if my assumptions are not correct.

Ritaf
Responsive Resident
Responsive Resident

That exactly what I did, I thought I need different logic, but it's good enough, I will stay with it.

Thank you.

 

amitchandak
Super User
Super User

@Ritaf , with date table joining to date of report, should give you new cars every month with help from month and year columns?

 

Can you share sample output in table format?

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.