cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Postigo Regular Visitor
Regular Visitor

End of chart needs to be the month of current date

Hello,  the ending date of the chart needs to be the month of the current date. I created a calendar table 

 
Table = CALENDAR(DATE(YEAR(TODAY())-1;MONTH(TODAY());01);TODAY())
( i want just 1 year of information in this chart, but another years on the dashboard)
 
and a measure
 
Measure = IF(ISBLANK(DISTINCTCOUNT(fOrder[K_NumberOrder]));0;DISTINCTCOUNT(fOrder[K_NumberOrder]))
(i need to fill the empty records with zero)

When i put the line chart ( Table[Date] (hierarchy with year and month) in axis and measure in values), the axis go until December 2019 (but the last record in my calendar is february 27). If i choose the date(with days) the chart bring me the right dates




PowerBiLine.png
1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: End of chart needs to be the month of current date

Hi @Postigo 

 

You use the Date Hierarchy.So please try to use below measures:

Measure =
IF (
    MAX ( 'Table'[Date].[Date] ) <= TODAY (),
    IF (
        ISBLANK ( DISTINCTCOUNT ( fOrder[K_NumberOrder] ) ),
        0,
        DISTINCTCOUNT ( fOrder[K_NumberOrder] )
    )
)

Or

Measure 2 =
IF (
    MAX ( 'Table'[Date].[Date] ) <= TODAY (),
    CALCULATE ( DISTINCTCOUNT ( fOrder[K_NumberOrder] ) ) + 0
)

Regards,

Cherie

 

 

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 REPLIES 2
Community Support Team
Community Support Team

Re: End of chart needs to be the month of current date

Hi @Postigo 

 

You use the Date Hierarchy.So please try to use below measures:

Measure =
IF (
    MAX ( 'Table'[Date].[Date] ) <= TODAY (),
    IF (
        ISBLANK ( DISTINCTCOUNT ( fOrder[K_NumberOrder] ) ),
        0,
        DISTINCTCOUNT ( fOrder[K_NumberOrder] )
    )
)

Or

Measure 2 =
IF (
    MAX ( 'Table'[Date].[Date] ) <= TODAY (),
    CALCULATE ( DISTINCTCOUNT ( fOrder[K_NumberOrder] ) ) + 0
)

Regards,

Cherie

 

 

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Postigo Regular Visitor
Regular Visitor

Re: End of chart needs to be the month of current date

Can i use the same measure for the quarter?