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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Looking for formula SUMPRODUCT(1/COUNTIF(data,data)) in power BI

Hi everyone,

 

is there anyone know what the calculation is in power bi for this calculation in Excel?

SUMPRODUCT(1/COUNTIF(data,data))

 

Thanks in advance

 

1 ACCEPTED SOLUTION

The SUMPRODUCT isn't doing anything in your formula. Remove it in Excel and you'll get the same.

 

As for doing this in DAX, pseudocode would be something along the lines of this for a calculated column. 

IsUnique = 
VAR ThisDate = [Date]
VAR ThisName = [Name]
VAR RecordCount =
    COUNTROWS(
        FILTER(
            'Table',
            [Date] = ThisDate && [Name] = ThisName
        )
    )
RETURN
DIVIDE(1, RecordCount)

 

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

I did a calculation in Excel by using the formula SUMPRODUCT(1/COUNTIF(data,data)) to calcualte the Column D. Could you please help me to do the same calculation in Power BI?

 

Capture1111.PNG

@edhans 

 

Or, I could also use key to calculate it. I think it will easier to do it in power BI.

dddd.PNG

 

The SUMPRODUCT isn't doing anything in your formula. Remove it in Excel and you'll get the same.

 

As for doing this in DAX, pseudocode would be something along the lines of this for a calculated column. 

IsUnique = 
VAR ThisDate = [Date]
VAR ThisName = [Name]
VAR RecordCount =
    COUNTROWS(
        FILTER(
            'Table',
            [Date] = ThisDate && [Name] = ThisName
        )
    )
RETURN
DIVIDE(1, RecordCount)

 

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
Anonymous
Not applicable

Thanks 

it is very useful

 

amitchandak
Super User
Super User

You can have like

 

measure = sumx(Table,1/(if(not(isblank(table[column])),table[column],blank())))

Or
measure = sumx(Table,divide(1,table[column]))

 

edhans
Super User
Super User

What does that do in Excel? If CountIF() returns 3, then it is sumproduct(1/3) which is sumproduct(.33333) which is just .33333. Sumproduct isn't doing anything.

 

Can you provide us some sample data and expected output? Power BI doesn't work like Excel. Tables in Power BI are not the same thing as spreadsheets so sometimes using Excel equivalent formulas is the wrong approach.

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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