Forum Discussion
Requirement to count based on In date and out date
- 3 years ago
Hi , VenkatTav
According to your description, you want to "count based on In date and out date".
Here are the steps you can refer to :
(1)This is my test data:(2)We need to create a date table as a dimension table . And we do not need to create relationship between two tables.
Date = CALENDAR(DATE(2022,1,1) , LASTDATE('Table'[bankrupty date out]))(3)Then we need to create a measure:
Measure = var _cur_date = MIN('Date'[Date]) var _first_date = EOMONTH(_cur_date ,-1)+1 var _last_date = EOMONTH(_cur_date,0)+1 var _t = FILTER( ALLSELECTED('Table') , 'Table'[bankrupty date in]<= _first_date && 'Table'[bankrupty date out] >= _last_date) return COUNTROWS(_t)+0(4)Then we put the fields we need on the visual and we can meet your need:
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi , VenkatTav
According to your description, you want to "count based on In date and out date".
Here are the steps you can refer to :
(1)This is my test data:
(2)We need to create a date table as a dimension table . And we do not need to create relationship between two tables.
Date = CALENDAR(DATE(2022,1,1) , LASTDATE('Table'[bankrupty date out]))
(3)Then we need to create a measure:
Measure = var _cur_date = MIN('Date'[Date])
var _first_date = EOMONTH(_cur_date ,-1)+1
var _last_date = EOMONTH(_cur_date,0)+1
var _t = FILTER( ALLSELECTED('Table') , 'Table'[bankrupty date in]<= _first_date && 'Table'[bankrupty date out] >= _last_date)
return
COUNTROWS(_t)+0
(4)Then we put the fields we need on the visual and we can meet your need:
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly