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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
JC2022
Helper III
Helper III

How to stop a line

Hi,

I have created 2 measures for the cumulative sales. 1 for Previous fiscal year and 1 for Current Fiscal year for the completed months. At the moment March is still not completed that's why this is not in scope of the line for Current fiscal year. I would like to end this line after the last completed month, but I do not know how. Can you help me? See my formula below!
My result now is shown here:

JC2022_0-1680256294146.png

 

My desired result should be:

JC2022_1-1680256651945.png

 

Formula Current Fiscal Year:

Current Fiscal Year Cumulative Sales for completed months =
CALCULATE(
    SUM(Append3[EUR Sales]),
    FILTER(
        ALLSELECTED('Calendar Posting Date'),
        'Calendar Posting Date'[CurFiscalYearOffset] = 0 &&
        'Calendar Posting Date'[FiscalMonthNum] <= MAX('Calendar Posting Date'[FiscalMonthNum]) &&
        'Calendar Posting Date'[CurrentDayOffset] < 0 &&
        'Calendar Posting Date'[CurMonthOffset] <= -1
    )
)

 

5 REPLIES 5
JC2022
Helper III
Helper III

Hi @FreemanZ 
This formula gives the following error: Too few arguments were passed to the IF function. The minimum argument count for the function is 2.

Sorry, try like:

Measure =
IF(
MAX('Calendar Posting Date'[Date])<=MAX(Append3[Date]),
[Current Fiscal Year Cumulative Sales for completed months]
)

 

forgot to close the bracket. 

@FreemanZ 
This is the result of this formula. Not what I was expecting.

JC2022_0-1680271964610.png

 

@FreemanZ 
I have also tried the following formula:

FYTD Sales =
VAR CurMonthOffset = MAX('Calendar Posting Date'[CurMonthOffset])
RETURN
    CALCULATE(
        IF(CurMonthOffset > -1, BLANK(), SUM(Append3[EUR Sales])),
        FILTER(
            ALLSELECTED('Calendar Posting Date'),
            'Calendar Posting Date'[CurFiscalYearOffset] = 0 &&
            'Calendar Posting Date'[FiscalMonthNum] <= MAX('Calendar Posting Date'[FiscalMonthNum]) &&
            'Calendar Posting Date'[CurrentDayOffset] < 0 &&
            IF('Calendar Posting Date'[CurMonthOffset] > -1, BLANK(), 'Calendar Posting Date'[CurMonthOffset] <= -1)
    )
)

The result will only show the line for January and February and not the first 3 month of the Fiscal Year.

JC2022_1-1680274165932.png

 

FreemanZ
Super User
Super User

hi @JC2022 

try to plot a measure like this instead:

Measure =
IF(
    MAX('Calendar Posting Date'[Date]<=MAX(Append3[Date]),
    [Current Fiscal Year Cumulative Sales for completed months]
)

 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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

Top Solution Authors