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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Rolling 5 months bar chart gives 6 bars

Hi,

I have this simple scenario where I need to calculate a rolling past 5 months (not including the current month) for a given transaction.

I have a Date table and link it to my transaction table. For unknown reason, the graph displays a sixth bar instead of 5.

Could someone help to get this fixed?

The DAX script is:

TY Actions =

VAR EndDate =

  EOMONTH ( TODAY (), -1 )

  VAR StartDate = EDATE ( EOMONTH ( TODAY (), -1 ), -5 ) +1

RETURN

  CALCULATE (

    SUM(UserActions[t_UserActions]),

    CALCULATETABLE ( 'Date', FILTER ( 'Date', 'Date'[Date] >= StartDate && 'Date'[Date] <= EndDate ) ) )

 

Screenshot 2021-03-15 at 14.39.25.png

Many thanks,

Guy

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try a measure like

 

TY Actions =

VAR EndDate =
EOMONTH ( TODAY (), -1 )
VAR StartDate = EOMONTH ( TODAY (), -6 ) +1

RETURN

CALCULATE (

SUM(UserActions[t_UserActions]),FILTER ( 'Date', 'Date'[Date] >= StartDate && 'Date'[Date] <= EndDate ) )

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Try a measure like

 

TY Actions =

VAR EndDate =
EOMONTH ( TODAY (), -1 )
VAR StartDate = EOMONTH ( TODAY (), -6 ) +1

RETURN

CALCULATE (

SUM(UserActions[t_UserActions]),FILTER ( 'Date', 'Date'[Date] >= StartDate && 'Date'[Date] <= EndDate ) )

Anonymous
Not applicable

Brilliant! Thanks a lot.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.