cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
blackavipowerbi
New Member

Last year same "DAY" not working

Hello, i have made the table as the image. I select the day that i want to compare with the same month, last year at the same day. In the corrent month, last year is not working. Can someone help me? The formula was:

 

Qtd. de Atd. 1 ANOS Anterior =
CALCULATE(
[Qtd. de Atendimentos],
DATEADD(ATDCalendario[Date],-12,MONTH)
)
 
blackavipowerbi_0-1636460707492.png

 

blackavipowerbi_1-1636460737250.png

 

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @blackavipowerbi,

Perhaps you can try to use the following formulas if helps:

Qtd. de Atendimentos =
VAR curr =
    MAX ( 'ATD'[MATRÍCULA] )
RETURN
    CALCULATE (
        COUNTA ( 'ATD'[MATRÍCULA] ),
        FILTER (
            ALLSELECTED ( 'ATD' ),
            'ATD'[MATRÍCULA] <= curr
                && QUARTER ( 'ATD'[MATRÍCULA] ) = QUARTER ( curr )
                && YEAR ( 'ATD'[MATRÍCULA] )
                    = YEAR ( curr ) - 1
        )
    )

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

4 REPLIES 4
v-shex-msft
Community Support
Community Support

Hi @blackavipowerbi,

Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or accept the helpful suggestions to help others who faced similar requirements.

If these also don't help, please share more detailed information to help us clarify your scenario to test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

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

Hi @blackavipowerbi,

Perhaps you can try to use the following formulas if helps:

Qtd. de Atendimentos =
VAR curr =
    MAX ( 'ATD'[MATRÍCULA] )
RETURN
    CALCULATE (
        COUNTA ( 'ATD'[MATRÍCULA] ),
        FILTER (
            ALLSELECTED ( 'ATD' ),
            'ATD'[MATRÍCULA] <= curr
                && QUARTER ( 'ATD'[MATRÍCULA] ) = QUARTER ( curr )
                && YEAR ( 'ATD'[MATRÍCULA] )
                    = YEAR ( curr ) - 1
        )
    )

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

amitchandak
Super User
Super User

@blackavipowerbi , Make sure ATDCalendario is date table and marked as Date table(Option on right click of the table)

 

Also, hoping measure [Qtd. de Atendimentos] is not using any time intelligence function

 

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!

Tks!!! Qtd. de Atendimentos calc is like this:

Qtd. de Atendimentos =
CALCULATE(
    COUNTA('ATD'[MATRÍCULA]),
    FILTER(
        ALLSELECTED('ATD'[MATRÍCULA]),
        ISONORAFTER('ATD'[MATRÍCULA], MAX('ATD'[MATRÍCULA]), DESC)
    )
)

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors