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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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
v-cherch-msft
Employee
Employee

Hi @Anonymous 

 

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.

View solution in original post

2 REPLIES 2
v-cherch-msft
Employee
Employee

Hi @Anonymous 

 

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.
Anonymous
Not applicable

Can i use the same measure for the quarter?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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