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.
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
Solved! Go to 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)
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingI 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?
Or, I could also use key to calculate it. I think it will easier to do it in power BI.
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)
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingThanks
it is very useful
You can have like
measure = sumx(Table,1/(if(not(isblank(table[column])),table[column],blank())))
Or
measure = sumx(Table,divide(1,table[column]))
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.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingCovering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
80 | |
64 | |
57 |
User | Count |
---|---|
145 | |
111 | |
92 | |
84 | |
66 |