Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

getting a count of different statuses in a column

Hello Community -  Well, I thought this was going to be simpler than this.  

 

I have a Salesforce column for "status" in my Opportunity table.    I have the "closed date" column in that table connected to my main date table in an inactive relationship.    In essence, what I am trying to do is get a count of the number of "Won" or "Lost" opportunities based on the closed date.    I was hoping to use variables, but this formula below is not working at all.  Any help is appreciated!

Count of Status =
VAR _WonCount = CALCULATE(COUNTROWS('Sf_Opportunity Line'),'Sf_Opportunity Line'[Status__c] = "Won",USERELATIONSHIP('Dim_Date Table'[Date],'Sf_Opportunity Line'[CloseDate]))
VAR _LostCount = CALCULATE(COUNTROWS('Sf_Opportunity Line'), 'Sf_Opportunity Line'[Status__c] = "Lost",USERELATIONSHIP('Dim_Date Table'[Date],'Sf_Opportunity Line'[CloseDate]))
RETURN
IF(ISINSCOPE('Sf_Opportunity Line'[Status__c]) = "Won",_WonCount,_LostCount)
1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Anonymous 
Since you are slicing by Status the use only

Count of Status =
CALCULATE (
    COUNTROWS ( 'Sf_Opportunity Line' ),
    USERELATIONSHIP ( 'Dim_Date Table'[Date], 'Sf_Opportunity Line'[CloseDate] )
)

View solution in original post

1 REPLY 1
tamerj1
Super User
Super User

Hi @Anonymous 
Since you are slicing by Status the use only

Count of Status =
CALCULATE (
    COUNTROWS ( 'Sf_Opportunity Line' ),
    USERELATIONSHIP ( 'Dim_Date Table'[Date], 'Sf_Opportunity Line'[CloseDate] )
)

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.