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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Tani4ka
Helper I
Helper I

Average for Current months only and totals for the rest of the months

Hi there,

I need to create a dynamic measure that will do next:

 

1. if the date is current month , then 

YoY sales = (Sales/ ((Sales LY / number of days in the months) *number of days Months to date)) -1

 

otherwise 

 

YoY sales = calculate(divide([sales],[Sales LY]), -1)

 

I used the below dax to get the number of days in the months 

 

no_days =
DATEDIFF(
EOMONTH(MAX(dim_date[full_date]),-1),
EOMONTH(MAX(dim_date[full_date]),-0),DAY)
 
and for the curent month:
Current Month = MONTH(TODAY())
 
I'm not sure how to join this all together to get the correct results. The final resutls should be YoY for past months and for the current month only avg based on the number of days.
Assuming today is the 3rd March expected results should be -31% not -93%
Tani4ka_0-1646056436040.png
 
 Thanks a lot for all your help,
T

 

2 REPLIES 2
Thejeswar
Community Champion
Community Champion

Hi @Tani4ka ,

If you can share a pbix file with some sample data, people would be easily able to help you much quicker

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.