Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
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
Year | Number of beehives |
1990 | 20 000 |
1991 | 25 000 |
1992 | 30 000 |
1993 | 28 000 |
Solved! Go to 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..
What about applying filters for assigned comparison visual with selected years? Is equal for year xxx and xxx
@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..
@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.
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.