Forum Discussion
Cumulative Distinct Counts Dual Axis Line Viz
- 6 years ago
Hello @TDisco ,
Create a new table that contains all the months of 2020:
Table 2 = CALENDAR(DATE(2020,1,1),DATE(2020,12,31))Next, create two measures to open and close:
Opened = IF(MONTH(MAX('Table 2'[Date]))<= MONTH(TODAY()),CALCULATE(DISTINCTCOUNT('Table'[Project]),FILTER(ALL('Table'),'Table'[Status] = "Open" &&MONTH('Table'[Start])<=MONTH(MAX('Table 2'[Date])) && YEAR('Table'[Start]) = 2020)),BLANK()) Closed = IF(MONTH(MAX('Table 2'[Date]))<= MONTH(TODAY()),CALCULATE(DISTINCTCOUNT('Table'[Project]),FILTER(ALL('Table'),'Table'[Status] = "Closed" &&MONTH('Table'[End])<=MONTH(MAX('Table 2'[Date])) && YEAR('Table'[End]) = 2020)),BLANK())For more information, see: https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/EbHcCEyldfdGhGA5taClZ7IBhR_DkJVxRxziKTrmWnJrlQ?e=WYX5JU
If this post helps, then consider Accepting it as the solution to help other members find it more quickly.
Best regards
Dedmon Dai
TDisco , Check if this can blog help -https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970
- TDisco6 years ago
Helper I
hmm... have some data showing (thank you) how do I convert countx into DistinctCount?
_Current Employees = CALCULATE(COUNTx(FILTER('tbl_Projects_Pivot','tbl_Projects_Pivot'[StartDate]<=max('Date_Start'[Date]) && (ISBLANK('tbl_Projects_Pivot'[ActualEndDate]) || 'tbl_Projects_Pivot'[ActualEndDate]>max('Date_Start'[Date]))),('tbl_Projects_Pivot'[Id])))and_Last Period Employee =var _min_date = minx(all('Date_Start'),'Date_Start'[Date])var _Expression=if(ISFILTERED('Date_Start'[Month]),maxx('Date_Start',DATEADD('Date_Start'[Date],-1,MONTH)),maxx('Date_Start',DATEADD('Date_Start'[Date],-1,YEAR)))ReturnCALCULATE(COUNTx(FILTER('tbl_Projects_Pivot','tbl_Projects_Pivot'[StartDate]<=_Expression && 'tbl_Projects_Pivot'[StartDate]>=_min_date && (ISBLANK('tbl_Projects_Pivot'[ActualEndDate]) || 'tbl_Projects_Pivot'[ActualEndDate]>_Expression)),('tbl_Projects_Pivot'[Id])),CROSSFILTER('tbl_Projects_Pivot'[ActualEndDate],'Date_Start'[Date],None))- v-deddai1-msft6 years ago
Community Support
Hello @TDisco ,
Create a new table that contains all the months of 2020:
Table 2 = CALENDAR(DATE(2020,1,1),DATE(2020,12,31))Next, create two measures to open and close:
Opened = IF(MONTH(MAX('Table 2'[Date]))<= MONTH(TODAY()),CALCULATE(DISTINCTCOUNT('Table'[Project]),FILTER(ALL('Table'),'Table'[Status] = "Open" &&MONTH('Table'[Start])<=MONTH(MAX('Table 2'[Date])) && YEAR('Table'[Start]) = 2020)),BLANK()) Closed = IF(MONTH(MAX('Table 2'[Date]))<= MONTH(TODAY()),CALCULATE(DISTINCTCOUNT('Table'[Project]),FILTER(ALL('Table'),'Table'[Status] = "Closed" &&MONTH('Table'[End])<=MONTH(MAX('Table 2'[Date])) && YEAR('Table'[End]) = 2020)),BLANK())For more information, see: https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/EbHcCEyldfdGhGA5taClZ7IBhR_DkJVxRxziKTrmWnJrlQ?e=WYX5JU
If this post helps, then consider Accepting it as the solution to help other members find it more quickly.
Best regards
Dedmon Dai