Forum Discussion
gkarlo
Helper I
2 years agoCount orders with specific conditions
I hope someone may assist me with this... Currently I have a table of projects that can be Won, Lost or No Realized, the column of this os really exisiting, the problem that I have is that the same ...
- 2 years ago
Hi gkarlo,
Create a calculated column like this:
StatusValue = IF ( SampleData[Status] = "No Realized", 1, IF ( SampleData[Status] = "Lost", 2, 3 ) )And then create 3 measures like this:
No of Won = COUNTROWS ( FILTER ( SUMMARIZE ( SampleData, SampleData[Project], "MaxStatus", MAX ( SampleData[StatusValue] ) ), [MaxStatus] = 3 ) )No of Lost = COUNTROWS ( FILTER ( SUMMARIZE ( SampleData, SampleData[Project], "MaxStatus", MAX ( SampleData[StatusValue] ) ), [MaxStatus] = 2 ) )No of No Realized = COUNTROWS ( FILTER ( SUMMARIZE ( SampleData, SampleData[Project], "MaxStatus", MAX ( SampleData[StatusValue] ) ), [MaxStatus] = 1 ) )The same can be achieved using RANK formula also.
Tested:
Upvote and accept as a solution if it helped!
- 2 years ago
Hi gkarlo,
Sorry about that. I missed to replace COUNTROWS.
No of No Realized = SUMX ( FILTER ( ADDCOLUMNS( SUMMARIZE ( SampleData, SampleData[Project], "MaxStatus", MAX ( SampleData[StatusValue] ) ), "SumProject",SUMX(RELATEDTABLE(ProjectList),ProjectList[Price]) ), [MaxStatus] = 1 ), [SumProject] )
gkarlo
Helper I
2 years agoNo worries 😅, thanks too much, it works correctly 🙌
govindarajan_d
Super User
2 years agogkarlo, Glad it worked!