The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi everyone,
I was hoping for some help with a formula in PowerBi similar to a countif.
I have a column that contains
I need to calculate a new measures which is basically:
=(Promoters-Detractors)/(Detractors+Promoters+Passive)
How would I write this formula in PowerBi?
Thank you!
Solved! Go to Solution.
Hi everyone!
Thank you all for your help. I realized that I was making this extra tricky and ended up using "quick measures" instead.
The formulas looked like this:
Detractors
Hi everyone!
Thank you all for your help. I realized that I was making this extra tricky and ended up using "quick measures" instead.
The formulas looked like this:
Detractors
Hi @ledu ,
You could also pivot the column to get sum.
Here is my test file with two workrounds.
CountIf =
VAR Detractors =
CALCULATE (
COUNT ( 'TableName'[ColumnName] ),
FILTER ( 'TableName', 'TableName'[ColumnName] = "Detractors" )
)
VAR Promotors =
CALCULATE (
COUNT ( 'TableName'[ColumnName] ),
FILTER ( 'TableName', 'TableName'[ColumnName] = "Promotors" )
)
VAR Passives =
CALCULATE (
COUNT ( 'TableName'[ColumnName] ),
FILTER ( 'TableName', 'TableName'[ColumnName] = "Passives" )
)
VAR Result =
DIVIDE ( Promotors - Detractors, Detractors + Promotors + Passives )
RETURN
Result
hi @ledu ,
Could you please provide an example of how your data is set up? It will be much easier to come up with a solution that way.
Hi @ledu ,
Detractors = CALCULATE( SUM('Table'[Value]);FILTER('Table';'Table'[Column1] = "Detractors"))
Promoters = CALCULATE( SUM('Table'[Value]);FILTER('Table';'Table'[Column1] = "Promoters"))
Passives = CALCULATE( SUM('Table'[Value]);FILTER('Table';'Table'[Column1] = "Passives"))
Measure = ([Promoters]-[Detractors])/([Detractors]+[Promoters]+[Passives])
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.
Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials