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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
wi11iamr
Advocate II
Advocate II

Reference value from first Fiscal Month as denominator for subsequent months

Hi there,

 

I have a relatively complicated model where a number of measures relate to each other. For simplicites sake though, I can relate my problem as follows:

 

On a fiscal calendar of July to June, I have a measure TotalSales for each month which sums the total amount of sales recorded throughout the entire month (sales transactions recorded on any number of days within that month).

 

I now wish to divide each subsequent month's TotalSales by the first month's TotalSales to guage the variance.

In trying to capture the firt month's sales, I have the below measure with [First Sales Month Start] and [First Sales Month End] as 2 additional measures returning the dates of "01 July 2018" and "31 July 2018".

 

 

First Month Total Sales= 
CALCULATE(
[TotalSales],
DATESBETWEEN(
            'Calendar'[Date],
            [First Sales Month Start], 
            [First Sales Month End]
    )
)
    

While the above code doesn't give me any errors, it simply doesn't return any values. 

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@wi11iamr not sure how you are calculating first month start and end date. Can you replace these with fixed value to see if this measure works which will and that will tell the measure you are using to start and end date need revisit.

 

to use fixed value replace start and end date with date( 2018, 07, 01 ), date(2018, 07, 31)



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

3 REPLIES 3
parry2k
Super User
Super User

@wi11iamr not sure how you are calculating first month start and end date. Can you replace these with fixed value to see if this measure works which will and that will tell the measure you are using to start and end date need revisit.

 

to use fixed value replace start and end date with date( 2018, 07, 01 ), date(2018, 07, 31)



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Thanks @parry2k, the measure now works when using the fixed vallue dates as you suggested.

With a little more tinkering and investigative snooping, I found my mistake in the below code - it's quite laughable actually, as the "Start Date" I had mistakenly recorded as 31, instead of 1 and vice versa in the "End Date".

 

Thanks for your quick response and suggested path of investigation.

 

First Sales Month Start = 
    VAR FirstFiscalMonth = 7 /* Set the first month of the fiscal year */
    VAR LastDay =
        MIN ( 'Calendar'[Date] )
    VAR LastMonth =
        MONTH ( LastDay )
    VAR LastYear =
        YEAR ( LastDay )
            - IF ( LastMonth < FirstFiscalMonth, 1 )
    VAR FilterYtd =
        DATE ( LastYear, FirstFiscalMonth, 31 )
        
    RETURN
        FilterYtd
   

@wi11iamr awesome good for you. 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.