Forum Discussion
LastNonBlank formula help
- 7 years ago
Hi pokdbz,
I'm afraid you can't find the last status with that formula. Please refer to lastnonblank-function-dax.
LastStatusText =
LASTNONBLANK ( 'StoreTasks'[Status],
'StoreTasks'[Status] IN { "Completed" } // it returns true or false, which never be a blank.
)Let's take the Store 0002 and the role Bakery as an example, the last status always "Completed". What should it be?
If you are sure you did it in the right way, please try this formula to get the result.
Measure = SUMX ( SUMMARIZE ( StoreTasks, StoreTasks[Role], [StoreNumber], "Status", [LastStatusText] ), IF ( [Status] = "Completed", 1, 0 ) )
Best Regards,
Hi pokdbz,
Simply change Count to Distinctcount, please.
CountCompleted = CALCULATE ( DISTINCTCOUNT ( Table1[Role] ), Table1[Status] = "Completed" )
Best Regards,
Adding distinct just does the count on the whole dataset. There needs to be some incorporation of the LastNonBlank "Status"
Adding distinct produces this
Store Bakery Deli Meat Seafood Total
2 1 1 1 1 4
It should look like this, because Meat did not have a status of Completed
Store Bakery Deli Meat Seafood Total
2 1 1 0 1 3
Store Role Status
2 Meat In Progress
2 Meat Completed
2 Meat Completed
Since for Meat the last status is "In Progress" this should not be counted.