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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ram1212
Regular Visitor

Compare selected week days with similar days from the past periods

Hi,
I need some help how to create similar report with Power BI. I have no idea how to create such measures and such a report.

If I select one week in a filter, for example 2022.09.19-09.25,
then I should get 3 tables below - the exact output as you can see in my picture of excel sheet.
1st table - comparision of the selected and previous week
2nd table - comparision of the same periods of the previous year
3rd table - comparision of the same periods of the selected and previous year

If there are no data for some Date/Facility then the output in the tables should be 0 or 0%.

If no week or more weeks are selected then report should show no data.

 

ram1212_0-1704785667430.png

 

My test pbix 

1 ACCEPTED SOLUTION
ram1212
Regular Visitor

Soved it myself -  joined current and previous week tables, created grouped table and measures

View solution in original post

4 REPLIES 4
ram1212
Regular Visitor

Soved it myself -  joined current and previous week tables, created grouped table and measures

Anonymous
Not applicable

Hi @ram1212 ,

 

Based on the information you provided, you can follow these steps:

1.Add new column.

(1)

2022 =

IF (

    'FactTable'[Date] >= DATE ( 2022, 9, 19 )

        && 'FactTable'[Date] <= DATE ( 2022, 9, 25 ),

    "09.19-09.25d",

    "Previous week"

)

 

(2)

total =

'FactTable'[IN] + 'FactTable'[OUT]

 

vyifanwmsft_0-1704865263488.png

 

2.Add three new columns.

(1)

difference_in =

VAR _09 =

    CALCULATE (

        SUM ( FactTable[IN] ),

        FILTER (

            FactTable,

            FactTable[Facility] = EARLIER ( FactTable[Facility] )

                && FactTable[2022] = "09.19-09.25d"

        )

    )

VAR _pre =

    CALCULATE (

        SUM ( FactTable[IN] ),

        FILTER (

            FactTable,

            FactTable[Facility] = EARLIER ( FactTable[Facility] )

                && FactTable[2022] = "Previous week"

        )

    )

RETURN

    ( _09 / _pre ) - 1

 

(2)

difference_out =

VAR _09 =

    CALCULATE (

        SUM ( FactTable[OUT] ),

        FILTER (

            FactTable,

            FactTable[Facility] = EARLIER ( FactTable[Facility] )

                && FactTable[2022] = "09.19-09.25d"

        )

    )

VAR _pre =

    CALCULATE (

        SUM ( FactTable[OUT] ),

        FILTER (

            FactTable,

            FactTable[Facility] = EARLIER ( FactTable[Facility] )

                && FactTable[2022] = "Previous week"

        )

    )

RETURN

    ( _09 / _pre ) - 1

 

(3)

difference_TOTAL =

VAR _09 =

    CALCULATE (

        SUM ( FactTable[total] ),

        FILTER (

            FactTable,

            FactTable[Facility] = EARLIER ( FactTable[Facility] )

                && FactTable[2022] = "09.19-09.25d"

        )

    )

VAR _pre =

    CALCULATE (

        SUM ( FactTable[total] ),

        FILTER (

            FactTable,

            FactTable[Facility] = EARLIER ( FactTable[Facility] )

                && FactTable[2022] = "Previous week"

        )

    )

RETURN

    ( _09 / _pre ) - 1

 

Final output:

vyifanwmsft_1-1704865330344.png

 

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Ada Wang

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

I updated my first message with pbix file link 

Hi,

Thank you for your answer.

I updated my first message with more details

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.