Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Don't plot future months

Hi Experts

 

The following measure gives me data points on a line graph where there is data - if i have no data point i.e. zero or blank - i get a flat line. I want to be able to amend the measure so it only plots up until the current month -1. i.e, we are in March 21 which is zero in my data set, but i have values for Feb 21.

 

CurrentYear =
VAR CurrentYearSales =
CALCULATE ( SUM ( 'Test Data_'[cr03a_reportscrimemade] ), 'Test Data_'[IsCurrentYear] = TRUE () )
RETURN
IF ( CurrentYearSales = BLANK (), 0, CurrentYearSales )
  • Hi, Anonymous 

    Please try the below.

     

    CurrentYear =
    VAR CurrentYearSales =
    CALCULATE (
    SUM ( 'Test Data_'[cr03a_reportscrimemade] ),
    'Test Data_'[IsCurrentYear] = TRUE (),
    FILTER (
    ALLSELECTED ( 'Test Data_' ),
    [daterelatedcolumninthistable] <= TODAY ()
    )
    )
    RETURN
    IF ( CurrentYearSales = BLANK (), 0, CurrentYearSales )
     
    I hope it works.
     

    Hi, My name is Jihwan Kim.

    If this post helps, then please consider accept it as the solution to help the other members find it more quickly.

1 Reply

  • Hi, Anonymous 

    Please try the below.

     

    CurrentYear =
    VAR CurrentYearSales =
    CALCULATE (
    SUM ( 'Test Data_'[cr03a_reportscrimemade] ),
    'Test Data_'[IsCurrentYear] = TRUE (),
    FILTER (
    ALLSELECTED ( 'Test Data_' ),
    [daterelatedcolumninthistable] <= TODAY ()
    )
    )
    RETURN
    IF ( CurrentYearSales = BLANK (), 0, CurrentYearSales )
     
    I hope it works.
     

    Hi, My name is Jihwan Kim.

    If this post helps, then please consider accept it as the solution to help the other members find it more quickly.