Forum Discussion
Dynamic Status Calculation
- Anonymous1 year ago
Hi Haydos,
I modify the formula to get each status based on current date fields and merge them to show as text.
Record Status = VAR SelectedDate = MAX ( DateTable[Date] ) VAR CancelledDate = MAX ( T1[CancelledDate] ) VAR SettlementDate = MAX ( T1[SettlementDate] ) VAR ContractIssuedDate = MAX ( T1[ContractIssuedDate] ) VAR SoldDate = MAX ( T1[SoldDate] ) VAR isCancelled = IF ( CancelledDate <= SelectedDate && NOT ISBLANK ( CancelledDate ), "Cancelled" ) VAR isSettled = IF ( SettlementDate <= SelectedDate && NOT ISBLANK ( SettlementDate ), "Settled" ) VAR isContractIssued = IF ( ContractIssuedDate <= SelectedDate && NOT ISBLANK ( ContractIssuedDate ), "Contract Issued" ) VAR isSold = IF ( SoldDate <= SelectedDate && NOT ISBLANK ( SoldDate ), "Sold" ) VAR merged = IF ( isCancelled <> BLANK (), isCancelled & ";" ) & IF ( isSettled <> BLANK (), isSettled & ";" ) & IF ( isContractIssued <> BLANK (), isContractIssued & ";" ) & IF ( isSold <> BLANK (), isSold ) RETURN IF ( merged <> BLANK (), merged, "N/A" )Then you can add a new table with all status types and use it as category of the table visual and write a measure formula to count correspond status from the concatenated text.
Status Count = VAR currStatus = SELECTEDVALUE ( NewTable[Status] ) VAR summary = SUMMARIZE ( ALLSELECTED ( T1 ), [Customer], [SoldDate], [ContractIssuedDate], [SettlementDate], [CancelledDate], "Status", [Record Status] ) RETURN COUNTROWS ( FILTER ( summary, SEARCH ( currStatus, [Record Status], 1, -1 ) > 0 ) )
Regards,Xiaoxin Sheng
Hi Haydos
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.
https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523
- Haydos1 year ago
Advocate I
Thanks Rita, I've added some sample data to my original post now.