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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

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
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.