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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

yearly sales difference

hello guys.
i want to get the sales difference between years for that day of the week for that week in particularly.poiuyt.png

for ex. for P1W1 Tuesday sales for 2022 is 1813 and and for year 2023 is 1913 so the difference of sales would be 100. similary for wed, and all the days of all the weeks. i want a generalized formula so that it can be applied for all future years also.. i mean if i add up data for 2020 and 2021 then i can check difference of these years or if i want i can check it for year 2020 and 2023 also....very flexible formula.
Thank you

8 REPLIES 8
Anonymous
Not applicable

Hi @Anonymous ,

Please try this way.
Here is my sample dataset:

vjunyantmsft_0-1704256398277.png

I create three slicers:

vjunyantmsft_1-1704256424127.png

Use these three DAXs to create three measures to calculate:

HWS_CurrectYear = 
VAR C_Year = SELECTEDVALUE('Table'[Year])
VAR C_Period = SELECTEDVALUE('Table'[Period])
VAR C_Day = SELECTEDVALUE('Table'[Day])
RETURN
CALCULATE(
    MAX('Table'[HWS]),
    FILTER(
        ALL('Table'),
        'Table'[Year] = C_Year && 'Table'[Period] = C_Period && 'Table'[Day] = C_Day
    )
)
HWS_NextYear = 
VAR C_Year = SELECTEDVALUE('Table'[Year])
VAR C_Period = SELECTEDVALUE('Table'[Period])
VAR C_Day = SELECTEDVALUE('Table'[Day])
VAR Value_HWS = 
CALCULATE(
    MAX('Table'[HWS]),
    FILTER(
        ALL('Table'),
        'Table'[Year] = C_Year + 1 && 'Table'[Period] = C_Period && 'Table'[Day] = C_Day
    )
)
RETURN
IF(
    ISBLANK(C_Year + 1),
    0,
    Value_HWS
)
DIFFERENCE = 'Table'[HWS_NextYear] - 'Table'[HWS_CurrectYear]

The results are shown below:

vjunyantmsft_2-1704256571894.png


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

Anonymous
Not applicable

hello sir, thank you for ur solution but my requirement is to show in a table not in card. omewhat like this format. here each row is period and week..i.e p1w1,p1w2,p1w3nyujhgfds.png

Anonymous
Not applicable

Hi @Anonymous ๏ผŒ

I'm sorry I don't quite understand what results you need to get? I don't quite understand the graph you gave me,

vjunyantmsft_0-1704265144001.png

could you please show your desired results in excel or some other form?
For example, what kind of result should he get from the sample dataset I used, according to your expectations?

Best Regards,
Dino Tao

Anonymous
Not applicable

mnbvc.png

hope this helps u sir. 

If you send me proper sample data, I can do this visual for you. I think...

Anonymous
Not applicable

Hi @Anonymous ,

I'm sorry to say that the visual object format you're looking for can't be realized in Desktop at this time, but I suggest you post this idea on the idea forum, and hopefully it will be implemented in a future version of Desktop.
Home (microsoft.com)
This section can be implemented separately, but the "Difference" field cannot be displayed:

vjunyantmsft_0-1704268475137.png

vjunyantmsft_1-1704268486194.png


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

Anonymous
Not applicable

can we develop any measure for this or is this can be done by formula ??

zenisekd
Super User
Super User

I would suggest you create (calculate) a reference column +1 year, based on which you self merge the table. 
This way for one line you would get the actual value and the -1 year value and then you do the calculation you need.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon โ€“ Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save โ‚ฌ200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors