Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hi, I hope someone help me with a DATESBETWEEN function error.
Prepared tables are like below:
Table A : a period of item production
| Country | Segments | Item name | Period - start | Period - end |
| Japan | A | xxx | 2013/1/1 | 2015/12/31 |
| Japan | A | yyy | 2010/1/1 | 2020/12/31 |
| Japan | B | zzz | 2020/1/1 | 2025/12/31 |
| India | A | aaa | 2018/1/1 | 2020/12/31 |
| India | C | bbb | 2040/1/1 | 2045/12/31 |
| Indonesia | B | ccc | 2030/1/1 | 2035/12/31 |
| Indonesia | C | ddd | 2025/1/1 | 2030/12/31 |
| ・・・ | ・・・ | ・・・ | ・・・ | ・・・ |
Table B : global market volume
| County | CY | Volume |
| Japan | 2020 | 1000000 |
| Japan | 2021 | 1200000 |
| Indonesia | 2020 | 2000000 |
| ・・・ | ・・・ | ・・・ |
What I want to do is : changing x-axis of a graph by selecting country
e.g. Japan -> from 2010 to 2025
・a slicer
・a gragh
What I tried: DATESBETWEEN function
Thanks,
Chihiro
HI @ChihiroWa ,
DATESBETWEEN is a table function and will return a table of dates if used in creating a calculated table. If used in a measure, it is to filter an aggregation and is to be used together with CALCULATE. The correct syntax is something like
=
CALCULATE (
[Measure],
DATESBETWEEN (
TableB,
FIRSTDATE ( 'TableA'[Period - start] ),
LASTDATE ( 'TableA'[Period - end] )
)
)
@danextian ,Thanks a lot!
I found using DATESBETWEEN is not a good way to solve my problem.
If you have, could you tell me some other better ways ?
The answer really depends on your use case but information provided isnt enough to propose more appropriate one. What is the data used in your area chart? Is that volume? If so, your field pane should look something like this.
Also, the formula below will not even return a table of dates as you are comparing a year against a date.
=
DATESBETWEEN (
'TableB'[CY],
FIRSTDATE ( 'TableA'[Period - start] ),
LASTDATE ( 'TableA'[Period - end] )
)
Just DATESBETWEEN should be something like this. In your example, CY is year.
DATESBETWEEN(<Dates>, <StartDate>, <EndDate>)
Yes, the area chart shows volume, and field pane looks something like that.
Actually, Table B has thousand of rows, sorry for making confuse you.
As to CY, I prepared 'CY[date]' to recognize CY as a date.
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 42 | |
| 37 | |
| 34 | |
| 21 | |
| 16 |
| User | Count |
|---|---|
| 65 | |
| 62 | |
| 31 | |
| 26 | |
| 25 |