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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Column with values from different period

Hello everyone,

 

I'm looking for a column that equals the headcount column below except for 2018, where I want to "overwrite" the headcount with December 18 values. So if Dec18 = 1 than all other months in 18 should be 1 too. Anybody knows an easy way to do this?

 

I tried to use dateadd with instead of "-1" using "+(12 - Month)" but that returns only blanks.

 

Thanks

 

NameYearMonth numberMonthHeadcount

Person120181January1
Person120182February1
Person120183March1
Person120184April1
Person120185May1
Person120186June1
Person120187July1
Person120188August1
Person120189September1
Person1201810October1
Person1201811November1
Person1201812December1
Person120191January1
Person120192February1
Person120193March1
Person120194April1
Person120195May1
Person120196June0
Person120197July0
Person120198August0
Person120199September0
Person1201910October0
Person1201911November0
Person1201912December0
Person220181January1
Person220182February1
Person220183March1
Person220184April1
Person220185May1
Person220186June1
Person220187July1
Person220188August1
Person220189September1
Person2201810October1
Person2201811November0
Person2201812December0
Person220191January0
Person220192February0
Person220193March0
Person220194April0
Person220195May0
Person220196June0
Person220197July0
Person220198August0
Person220199September0
Person2201910October0
Person2201911November0
Person2201912December0
3 REPLIES 3
v-lili6-msft
Community Support
Community Support

HI, @Anonymous

I'm a little confused about your description, do you mean that just for 2018, if headcount on December 18 =1 then all other months in 18 should be 1 too, otherwise the headcount should stay the same?

If so, try this formual:

Column = 
VAR Dec18 =
    IF (
        Table1[Year] = 2018,
        CALCULATE (
            SUM ( Table1[Headcount] ),
            FILTER (
                Table1,
                Table1[Name] = EARLIER ( Table1[Name] )
                    && Table1[Year] = 2018
                    && Table1[Month] = 12
            )
        )
    )
RETURN
    IF ( Dec18 = 1, 1, Table1[Headcount] )

If not your case, please share the expected output of the sample data below.

 

Best Regards,

Lin

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi v-lili6-msft,

 

Thank you very much! It is like you say, except that Jan18 to Nov18 should be set equal to Dec18 always (so not only if Dec 18=1). Would that change the logic?

hi, @Anonymous 

You could try it by yourself, the logic should be the same.

If it is not your case, please share pbix file or some data sample and expected output. Do mask sensitive data before uploading.

 

 

Best Regards,

Lin

 

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

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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