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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. 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
v-shex-msft
Community Support
Community Support

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
iyanaardnas1
New Member

any answers?

Helpful resources

Announcements
Fabcon_Europe_Social_Bogo

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.