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

Creating a count of different statuses in a column (and using an inactive date relationship)

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
HoangHugo
Solution Specialist
Solution Specialist

Hi

ISINSCOPE return TRUE/FALSE, not use to compare with text, I think you mean

 

RETURN
IF(SELECTEDVALUE('Sf_Opportunity Line'[Status__c]) = "Won",_WonCount,_LostCount)

View solution in original post

1 REPLY 1
HoangHugo
Solution Specialist
Solution Specialist

Hi

ISINSCOPE return TRUE/FALSE, not use to compare with text, I think you mean

 

RETURN
IF(SELECTEDVALUE('Sf_Opportunity Line'[Status__c]) = "Won",_WonCount,_LostCount)

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.