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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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