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
iyanaardnas1
New Member

help me with the dax

Hi All,
I Want to fetch the Values for all the months in the slicer from the below dax1.
i have 2 dax's where dax1 is fetching correct values(totals) but month slicer for prev month selection displaying blank and other dax2 not correct value (totals) but fetching for all months with month slicer. so can anyone help me in modifying DAX1 (HC new).


dax used are:
Dax1(prev month and year not fetching values but value is correct)

HC new =

VAR MaxActivityDate = MAX(sales_snap[Activitydate])

RETURN

    IF(

        TODAY() = MaxActivityDate,

        CALCULATE(

            SUM(sales_snap[HeadCount]),

            FILTER(

                sales_snap,

                sales_snap[Activitydate] = MaxActivityDate

            )

        )

    )
DAX2(prev month and year fetching values but value is incorrect)

HeadCount = CALCULATE(SUM(sales_snap[HeadCount]),LASTDATE(sales_snap[Activitydate]))

 

iyanaardnas1_0-1715704706599.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @iyanaardnas1,

You can try to use the following measure formulas if it suitable for your requirement:

HC new =
VAR MaxActivityDate =
    MAX ( sales_snap[Activitydate] )
RETURN
    IF (
        TODAY () = MaxActivityDate,
        CALCULATE (
            SUM ( sales_snap[HeadCount] ),
            FILTER (
                ALLSELECTED ( sales_snap ),
                sales_snap[Activitydate] = MaxActivityDate
            )
        )
    )

Regards,

Xiaoxin Sheng

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

HI @iyanaardnas1,

You can try to use the following measure formulas if it suitable for your requirement:

HC new =
VAR MaxActivityDate =
    MAX ( sales_snap[Activitydate] )
RETURN
    IF (
        TODAY () = MaxActivityDate,
        CALCULATE (
            SUM ( sales_snap[HeadCount] ),
            FILTER (
                ALLSELECTED ( sales_snap ),
                sales_snap[Activitydate] = MaxActivityDate
            )
        )
    )

Regards,

Xiaoxin Sheng

iyanaardnas1
New Member

any answers?

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.