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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

How to calculate days between 01/01/2021 and 31/01/2021 and the data is in the same column

How to calculate days between 01/01/2021 and 31/01/2021 and the data is in the same column

Pojanakorn_0-1650623487398.png

 

1 ACCEPTED SOLUTION
v-cazheng-msft
Community Support
Community Support

Hi @Anonymous ,

 

Not very sure about your expected result. Maybe you would like to do some calculations in a specific range of dates. If so, you could take the following example as reference.

Sample data

vcazhengmsft_0-1650941531952.png

 

Do calculations between 01/01/2021 and 31/01/2021 with measure, for instance, sum data between this range.

vcazhengmsft_1-1650941531954.png

 

Create a Measure to the sum:

SumInRange = CALCULATE(SUM('Table'[Data]),FILTER('Table','Table'[Date]>=DATE(2021,1,1)&&'Table'[Date]<=DATE(2021,1,31)))

 

Then, the result will look like this.

vcazhengmsft_2-1650941531955.png

 

Or count days in this range with the following measure.

CountDaysInRange = CALCULATE(COUNT('Table'[Data]),FILTER('Table','Table'[Date]>=DATE(2021,1,1)&&'Table'[Date]<=DATE(2021,1,31)))

 

Then, the visual looks like this.

vcazhengmsft_3-1650941531955.png

 

So basically, you need use function like FILTER to filter data in the range you specified and then specify calculation expressions in the first parameter of CALCULATE.

 

Here are some links of corresponding dax functions that may help you.

FILTER function (DAX) - DAX | Microsoft Docs

CALCULATE function (DAX) - DAX | Microsoft Docs

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

View solution in original post

2 REPLIES 2
v-cazheng-msft
Community Support
Community Support

Hi @Anonymous ,

 

Not very sure about your expected result. Maybe you would like to do some calculations in a specific range of dates. If so, you could take the following example as reference.

Sample data

vcazhengmsft_0-1650941531952.png

 

Do calculations between 01/01/2021 and 31/01/2021 with measure, for instance, sum data between this range.

vcazhengmsft_1-1650941531954.png

 

Create a Measure to the sum:

SumInRange = CALCULATE(SUM('Table'[Data]),FILTER('Table','Table'[Date]>=DATE(2021,1,1)&&'Table'[Date]<=DATE(2021,1,31)))

 

Then, the result will look like this.

vcazhengmsft_2-1650941531955.png

 

Or count days in this range with the following measure.

CountDaysInRange = CALCULATE(COUNT('Table'[Data]),FILTER('Table','Table'[Date]>=DATE(2021,1,1)&&'Table'[Date]<=DATE(2021,1,31)))

 

Then, the visual looks like this.

vcazhengmsft_3-1650941531955.png

 

So basically, you need use function like FILTER to filter data in the range you specified and then specify calculation expressions in the first parameter of CALCULATE.

 

Here are some links of corresponding dax functions that may help you.

FILTER function (DAX) - DAX | Microsoft Docs

CALCULATE function (DAX) - DAX | Microsoft Docs

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

tamerj1
Super User
Super User

Hi @Anonymous 

please clarify further 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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