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

Combination Annualized/Static Data for One Bar Chart

I need a measure that will allow me to create a bar chart with three years (2018, 2019, 2020) with 2020 as an annualized measure and 2018/19 pulling from static data.  (I am thinking an IF function of some sort ie if 2020 then multiply by 52, else use static data)

 

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

Hi @Anonymous 

Based on my understanding, your table has complete data for 2017-2019, but for 2020, there is only some weeks' data.

So you want to use average weeks' data for 2020 to predict whole year's data

by mutilpying average week's data by numbers of weeks of 2020.

To say easier, it is like below:

average weeks' data= total counts of 2020/weeks which data is not blank

numbers of year 2020=53

final=average weeks' data*53

If so,please look at my measure below:

Capture21.JPG

modify count =
VAR n_weeks =
    CALCULATE (
        DISTINCTCOUNT ( 'Calendar'[WeekNumberOfYear] ),
        FILTER (
            ALLSELECTED ( 'Calendar' ),
            'Calendar'[Year]
                = YEAR (
                    TODAY ()
                )
        )
    )
VAR sum_count =
    CALCULATE (
        COUNT ( Turnover[Departments Names] ),
        FILTER (
            ALLSELECTED ( Turnover ),
            Turnover[Year]
                = YEAR (
                    TODAY ()
                )
        )
    )
VAR counts_weeks =
    CALCULATE (
        DISTINCTCOUNT ( Turnover[Week Number] ),
        FILTER (
            ALLSELECTED ( Turnover ),
            Turnover[Year]
                = YEAR (
                    TODAY ()
                )
        )
    )
RETURN
    IF (
        MAX ( 'Calendar'[Year] )
            = YEAR (
                TODAY ()
            ),
        n_weeks
            * DIVIDE (
                sum_count,
                counts_weeks
            ),
        CALCULATE (
            DISTINCTCOUNT ( Turnover[Departments Names] ),
            FILTER (
                ALLSELECTED ( Turnover ),
                Turnover[Year]
                    = MAX ( Turnover[Year] )
            )
        )
    )

 

 

 

 

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

View solution in original post

3 REPLIES 3
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

Based on my understanding, your table has complete data for 2017-2019, but for 2020, there is only some weeks' data.

So you want to use average weeks' data for 2020 to predict whole year's data

by mutilpying average week's data by numbers of weeks of 2020.

To say easier, it is like below:

average weeks' data= total counts of 2020/weeks which data is not blank

numbers of year 2020=53

final=average weeks' data*53

If so,please look at my measure below:

Capture21.JPG

modify count =
VAR n_weeks =
    CALCULATE (
        DISTINCTCOUNT ( 'Calendar'[WeekNumberOfYear] ),
        FILTER (
            ALLSELECTED ( 'Calendar' ),
            'Calendar'[Year]
                = YEAR (
                    TODAY ()
                )
        )
    )
VAR sum_count =
    CALCULATE (
        COUNT ( Turnover[Departments Names] ),
        FILTER (
            ALLSELECTED ( Turnover ),
            Turnover[Year]
                = YEAR (
                    TODAY ()
                )
        )
    )
VAR counts_weeks =
    CALCULATE (
        DISTINCTCOUNT ( Turnover[Week Number] ),
        FILTER (
            ALLSELECTED ( Turnover ),
            Turnover[Year]
                = YEAR (
                    TODAY ()
                )
        )
    )
RETURN
    IF (
        MAX ( 'Calendar'[Year] )
            = YEAR (
                TODAY ()
            ),
        n_weeks
            * DIVIDE (
                sum_count,
                counts_weeks
            ),
        CALCULATE (
            DISTINCTCOUNT ( Turnover[Departments Names] ),
            FILTER (
                ALLSELECTED ( Turnover ),
                Turnover[Year]
                    = MAX ( Turnover[Year] )
            )
        )
    )

 

 

 

 

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

amitchandak
Super User
Super User

can you share some sample data.If possible please share a sample pbix file after removing sensitive information.Thanks.

My Recent Blog -

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

Anonymous
Not applicable

Hello @amitchandak ,

 

Please see attached sample dataset and model.  To contextualize, I would like the bar representing 2020 to be an annualized amount while using the static data from 2018/19 to populate their corresponding visual categories. 

 

Thank you,

 

Sample Data and Model

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.