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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
LD20
New Member

Make data blank after specific date (preferable after "today")

Hi all,

 

This is my first post, so if you have any general remarks on the way I ask for help, please let me know. 

 

on topic:

 

I am using the LINESTX function to predict values based on historucal data. In this case I want to predict the number of sales. In the picture below you can see that the data line (dark blue) is running after today and I think this will influence my results. So my question is how can I remove these values (0) into blanks?

 

The measure I created up to now is:

 
Sumparts =
VAR SUMPARTS1 =
    sum(Sales_per_Customer_per_Date[Invoiced_Quantity])
    return
    if(isblank(SUMPARTS1),0,SUMPARTS1)
   

So I think I have to add something to this measure. This measure I use finally in the linestx:

 

Simple linear regression =
VAR Known =
    FILTER (
        SELECTCOLUMNS (
            ALLSELECTED ( CaseCreatedDate[Date] ),
            "Known[X]", CaseCreatedDate[Date],
            "Known[Y]", [Sumparts]
        ),
        AND (
            NOT ( ISBLANK ( Known[X] ) ),
            NOT ( ISBLANK ( Known[Y] ) )
        )
    )
VAR SlopeIntercept =
    LINESTX(Known, Known[Y], Known[X])
VAR Slope =
    SELECTCOLUMNS(SlopeIntercept, [Slope1])
VAR Intercept =
    SELECTCOLUMNS(SlopeIntercept, [Intercept])
RETURN
    SUMX (
        DISTINCT ( CaseCreatedDate[Date] ),
        Intercept + Slope * CaseCreatedDate[Date])

 

example graph.JPG

 

Many thanks in advance! 

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

Try

Sumparts =
VAR MaxDate =
    MAX ( 'CaseCreatedDate'[Date] )
RETURN
    IF (
        MaxDate <= TODAY (),
        VAR SUMPARTS1 =
            SUM ( Sales_per_Customer_per_Date[Invoiced_Quantity] )
        RETURN
            IF ( ISBLANK ( SUMPARTS1 ), 0, SUMPARTS1 )
    )

View solution in original post

2 REPLIES 2
johnt75
Super User
Super User

Try

Sumparts =
VAR MaxDate =
    MAX ( 'CaseCreatedDate'[Date] )
RETURN
    IF (
        MaxDate <= TODAY (),
        VAR SUMPARTS1 =
            SUM ( Sales_per_Customer_per_Date[Invoiced_Quantity] )
        RETURN
            IF ( ISBLANK ( SUMPARTS1 ), 0, SUMPARTS1 )
    )

Thank you very much, looks like it works fine! 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.