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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
KatkaS
Post Patron
Post Patron

Comparing data by 10 years

Hello

could someone please help with following?

 

I have a simple table with two columns - Years (1990 - 2020) and Number of beehives.

I would like to compare year 2020 with years 2000 and 1990.

 

How would you do that?

 

Thank you very much!

 

example

YearNumber of beehives
199020 000
199125 000
199230 000
199328 000
  
  
  
  
1 ACCEPTED SOLUTION

@Anonymous and @mangaus1111 

 

Thank you very much both for your time!

 

I have no idea why the filtering with date doesn't work, format is date, not text,

so I used a bit "dirty" way to select a date:

Sum1990 = CALCULATE(SUM(table[number]),DATESBETWEEN(A_Year[Rok], DATE(1990,1,1), DATE(1990,1,1)))

 

I'm sure there is a smarter and nicer way, like create a variant or other, but I have to finish my task quickly and don't have time to search for different solution..

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

What about applying filters for assigned comparison visual with selected years? Is equal for year xxx and xxx

lukaszEltwin1_0-1665950504168.png

 

@Anonymous and @mangaus1111 

 

Thank you very much both for your time!

 

I have no idea why the filtering with date doesn't work, format is date, not text,

so I used a bit "dirty" way to select a date:

Sum1990 = CALCULATE(SUM(table[number]),DATESBETWEEN(A_Year[Rok], DATE(1990,1,1), DATE(1990,1,1)))

 

I'm sure there is a smarter and nicer way, like create a variant or other, but I have to finish my task quickly and don't have time to search for different solution..

KatkaS
Post Patron
Post Patron

@mangaus1111 Thank you, but unfortunately this doesn'ty work - comparing date and text:

 

DAX comparison operations do not support comparing values of type Date with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values.

 

 

mangaus1111
Solution Sage
Solution Sage

Hi @KatkaS ,

you can try the below 3 measures.

 

1) Sum 2020 =

CALCULATE( 

                    SUM('Table'[Number of beehives]),

                    'Table'[Year] = "2020"

                  )

2) Sum 2000 =

CALCULATE( 

                    SUM('Table'[Number of beehives]),

                    'Table'[Year] = "2020"

                  )

3) Delta = [Sum 2020] - [Sum 2000]

 

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

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors