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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Syndicate_Admin
Administrator
Administrator

Filter specific period for Area Chart with DAX

Hi 
I'm trying to show only the last 10 months in the area chart, Measure already filtered as shown below I want to add another one to retrieve only the last 10 months.

EVC Cumm. =
var lastdateevc = CALCULATE(LASTDATE(EVCDis[DatesID]),EVCDis[DisUnit]>0)
var m10 = edate(lastdateevc,-10)
return
IF(max(DatesID[DatesID])<lastdateevc ,BLANK(),
CALCULATE(
  SUM(EVCDis[DisUnit]),
  FILTER(
      ALLSELECTED(DatesID[DatesID]),
      DatesID[DatesID]<= MAX(DatesID[DatesID]))))
 
1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @Syndicate_Admin ,

According to your description, I create a sample.

EVCDis table:

vkalyjmsft_0-1660877732008.png

DatesID table:

vkalyjmsft_1-1660877784158.png

Here's my solution, create a measure.

Measure =
VAR lastdateevc =
    CALCULATE (
        LASTDATE ( EVCDis[DatesID] ),
        FILTER ( ALL ( 'EVCDis' ), EVCDis[DisUnit] > 0 )
    )
VAR m10 =
    EDATE ( lastdateevc, -10 )
RETURN
    IF (
        MAX ( DatesID[DatesID] ) < m10
            || MAX ( 'DatesID'[DatesID] ) > lastdateevc,
        BLANK (),
        CALCULATE (
            SUM ( EVCDis[DisUnit] ),
            FILTER (
                ALLSELECTED ( DatesID[DatesID] ),
                DatesID[DatesID] <= MAX ( DatesID[DatesID] )
            )
        )
    )

Put DatesID column from DatesID table and the measure in a chart, get the correct result.

vkalyjmsft_2-1660877895623.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

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

1 REPLY 1
v-yanjiang-msft
Community Support
Community Support

Hi @Syndicate_Admin ,

According to your description, I create a sample.

EVCDis table:

vkalyjmsft_0-1660877732008.png

DatesID table:

vkalyjmsft_1-1660877784158.png

Here's my solution, create a measure.

Measure =
VAR lastdateevc =
    CALCULATE (
        LASTDATE ( EVCDis[DatesID] ),
        FILTER ( ALL ( 'EVCDis' ), EVCDis[DisUnit] > 0 )
    )
VAR m10 =
    EDATE ( lastdateevc, -10 )
RETURN
    IF (
        MAX ( DatesID[DatesID] ) < m10
            || MAX ( 'DatesID'[DatesID] ) > lastdateevc,
        BLANK (),
        CALCULATE (
            SUM ( EVCDis[DisUnit] ),
            FILTER (
                ALLSELECTED ( DatesID[DatesID] ),
                DatesID[DatesID] <= MAX ( DatesID[DatesID] )
            )
        )
    )

Put DatesID column from DatesID table and the measure in a chart, get the correct result.

vkalyjmsft_2-1660877895623.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

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

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.