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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
GC26
New Member

Count rows in current financial year and compare to same time in previous financial year

Hi,

 

I am relatively new to PowerBi and I have been looking to practice on some example data.

 

My aim is to count the number of rows in my dataset (Based on number of fires and there is 1 fire per row) in the current financial year to date and the same time in the previous financial year (FY runs from 1/4 to 31/3).

 

I have come across a previous chat which I have replicated the solution from in my own dataset successfully. However this was designed for calendar year and I would like to ammend it for financial year.

 

Any help on how to do this based on the below DAX would be greatly appreciated.

 

Total Sales =

CALCULATE(SUM(Data[Sales]))

YTD prods =

CALCULATE (

    [Total Sales],

    FILTER (

        'Calendar',

        'Calendar'[Year] = YEAR ( TODAY () )

            && 'Calendar'[Date] <= TODAY ()

    )

)

LY YTD Sales =

CALCULATE (

    [Total Sales],

    FILTER (

        'Calendar',

        'Calendar'[Year]

            = YEAR ( TODAY () ) - 1

            && 'Calendar'[Date]

                <= EOMONTH ( TODAY (), -13 ) + DAY ( TODAY () )

    )

)

Difference% =

DIVIDE([YTD prods] - [LY YTD Sales],[LY YTD Sales])

0 REPLIES 0

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.