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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Count if earning positive

Hi,

 

I would like to create a new measure (in percentage) regarding what is the overall stability criteria regarding earnings for multiple companies. This is the table that I have:

DateCompany_ShortcutEarnings
2008-12-31MMM720347620
2008-12-31AOS23740234
2008-12-31SO72304726502
2008-12-31OZK2346700
2009-12-31MMM720357620
2009-12-31AOS13740234
2009-12-31SO72304756502
2009-12-31OZK2349700
2010-12-31MMM720307620
2010-12-31AOS19740234
2010-12-31SO72309056502
2010-12-31OZK2399700

 

I have created already 3 measures:

EARNINGS = SUM(Earnings[Earnings])

EARNINGS LY = Calculate([EARNINGS], SAMEPERIODLASTYEAR('Date'[Date]))

Diff Earnings = IF(ISBLANK([EARNINGS LY]),BLANK(),[EARNINGS]-[EARNINGS LY])

 
What I cannot figure out is how I can caculate now the stability criterion.
I want to check if Diff Earnings is positive or negative (for each company and year) and count this.
Then the overall value should be sth like this:
Stability Earnings = COUNT([pos])/COUNT([Diff Earnings])
 
Any help is appreciated,
Sebastian
 
1 ACCEPTED SOLUTION

6 REPLIES 6
amitchandak
Super User
Super User

This type of calc required context day of the month, calculation like this will help

 

overall = countX(values(Table[Date]),[Diff Earnings])
count positive overall = sumX(values(Table[Date]),if([Diff Earnings]>0,1,0))

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @

Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Proud to be a Datanaut Connect on Linkedin

Anonymous
Not applicable

@amitchandakThe overall measure works but not the second one. I get a blank.

The overall output should look like that:

Company_ShortcutStability Earnings
MMM0.5
AOS0.5
SO1
OZK1

I did not get your last calculation. But find the solution to get that

https://www.dropbox.com/s/l5wivh9xwnm1bsi/positiveChanges.pbix?dl=0

Anonymous
Not applicable

@amitchandakthank you so far, but I still do not get the output that I need. I have the same formulas that you provided but I always get for diff count = 1 and pos count = 1 for each company. This cannot be true. This should give me sth like this:

Company_Shortcutpos countdiff countstability (pos count / diff count)
MMM120.5
AOS120.5
SO221
OZK221

Check the file now. I think finally got what you wanted :https://www.dropbox.com/s/l5wivh9xwnm1bsi/positiveChanges.pbix?dl=0

Anonymous
Not applicable

thanks a lot!!!

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.