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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
SAMANTHKUMAR
New Member

Need Dax Support

Dear Sir,

 

Need to calculate Total Load & How many vehicles Newly added & Lost


Actually i want to calculte the Total Vehicle During FY based on Bill Date alongwith how many new Vehicles were add based on first vist date & how many vehicles lost in the same period using last visit date.


Thanking you

Samanth Kumarhttps://docs.google.com/spreadsheets/d/1sBk9MkoIQB2vxgVxJ1JTwzt4m_yfgnzp/edit?usp=drive_link&ouid=11... 

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

Hi @SAMANTHKUMAR ,

 

You can try formula like below:

Newly Added Vehicles = 
VAR FiscalYearStart =
    DATE ( YEAR ( MIN ( 'Table'[Bill Date] ) ), 4, 1 ) 
VAR FiscalYearEnd =
    DATE ( YEAR ( MIN ( 'Table'[Bill Date] ) ) + 1, 3, 31 )
RETURN
    CALCULATE (
        COUNTROWS ( 'Table' ),
        'Table'[First_Visit_Date] >= FiscalYearStart
            && 'Table'[First_Visit_Date] <= FiscalYearEnd
    )
Lost Vehicles = 
VAR FiscalYearStart =
    DATE ( YEAR ( MIN ( 'Table'[Bill Date] ) ), 4, 1 )
VAR FiscalYearEnd =
    DATE ( YEAR ( MIN ( 'Table'[Bill Date] ) ) + 1, 3, 31 )
RETURN
    CALCULATE (
        COUNTROWS ( 'Table' ),
        'Table'[Last_Visit_Date] >= FiscalYearStart
            && 'Table'[Last_Visit_Date] <= FiscalYearEnd
    )

vkongfanfmsft_0-1711002378609.png

Best Regards,
Adamk Kong

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-kongfanf-msft
Community Support
Community Support

Hi @SAMANTHKUMAR ,

 

You can try formula like below:

Newly Added Vehicles = 
VAR FiscalYearStart =
    DATE ( YEAR ( MIN ( 'Table'[Bill Date] ) ), 4, 1 ) 
VAR FiscalYearEnd =
    DATE ( YEAR ( MIN ( 'Table'[Bill Date] ) ) + 1, 3, 31 )
RETURN
    CALCULATE (
        COUNTROWS ( 'Table' ),
        'Table'[First_Visit_Date] >= FiscalYearStart
            && 'Table'[First_Visit_Date] <= FiscalYearEnd
    )
Lost Vehicles = 
VAR FiscalYearStart =
    DATE ( YEAR ( MIN ( 'Table'[Bill Date] ) ), 4, 1 )
VAR FiscalYearEnd =
    DATE ( YEAR ( MIN ( 'Table'[Bill Date] ) ) + 1, 3, 31 )
RETURN
    CALCULATE (
        COUNTROWS ( 'Table' ),
        'Table'[Last_Visit_Date] >= FiscalYearStart
            && 'Table'[Last_Visit_Date] <= FiscalYearEnd
    )

vkongfanfmsft_0-1711002378609.png

Best Regards,
Adamk Kong

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@SAMANTHKUMAR , You can follow approch

 

Customer Retention Part 1:
https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-1-Month-on-Month-Retention/b...

 

Customer Retention Part 5: LTD Vs Period Retention
https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-5-LTD-and-PeriodYoY-Retentio...

 

measures

//Only year vs Year, not a level below

This Year = CALCULATE([Total],filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE([Total],filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))

 

 

Lost Customer This Year = Sumx(VALUES(Customer[Customer Id]),if(ISBLANK([This Year]) && not(ISBLANK([Last Year])) , 1,BLANK()))
New Customer This Year = sumx(VALUES(Customer[Customer Id]), if(ISBLANK([Last Year]) && not(ISBLANK([This Year])) ,1,BLANK()))
Retained Customer This Year = if(not(ISBLANK([This Year])) && not(ISBLANK([Last Year])) , 1,BLANK())

 

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.