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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.