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.
Hello everyone,
I am new to the forum and I would be glad to anyone who could help me resolve the next issue :
The next image is a screenshot of my power bi report.
It is a table that contains :
This table is done as follows :
Now, I would like to compute the number of distinct accounts that have duplicates (ie counts >=2).
I tried the next formula :
#Distinct accounts =
CALCULATE(
DISTINCTCOUNT(FEC[CompteNum]),
FILTER(
FEC,
[#Occurences]) >= "2"
)
)
but I am running into an error that basically says that
In case, you would need my data model : here it is :
Sorry for the fact that my power bi interface is in French
Thank you in advance
Solved! Go to Solution.
@CheikhnaML You can try something like this. I added in the Montant as I assumed you only wanted to include accounts where they had the duplicate of the same Montant values.
CALCULATE (
DISTINCTCOUNT ( FEC[CompteNum] ),
FILTER (
ADDCOLUMNS (
SUMMARIZE (
'FEC',
'FEC'[CompteNum],
'FEC'[Montant] ),
"#Occurences", [#Occurences] )
[#Occurences] >= 2))
Hi @CheikhnaML
Happy to try and explain.
This is a simplistic example of what is happening in the DAX query I shared with you
This is my best attempt at explaining the logic. It would likely be helpful to review documentation from SQLBI about this topic. Best Practices Using SUMMARIZE and ADDCOLUMNS - SQLBI
Hi @CheikhnaML
Happy to try and explain.
This is a simplistic example of what is happening in the DAX query I shared with you
This is my best attempt at explaining the logic. It would likely be helpful to review documentation from SQLBI about this topic. Best Practices Using SUMMARIZE and ADDCOLUMNS - SQLBI
@thedatahiker Thank you for taking the time to answer my question.
I appreciate it.
@CheikhnaML You can try something like this. I added in the Montant as I assumed you only wanted to include accounts where they had the duplicate of the same Montant values.
CALCULATE (
DISTINCTCOUNT ( FEC[CompteNum] ),
FILTER (
ADDCOLUMNS (
SUMMARIZE (
'FEC',
'FEC'[CompteNum],
'FEC'[Montant] ),
"#Occurences", [#Occurences] )
[#Occurences] >= 2))
Hi @thedatahiker,
Thank you for your reply.
It worked.
Would you mind tell me why my formula was not working ?
Why was I obliged to used the "Summarize" fonction inside my "Filter" function in order to make it work ?
Thank you in advance.
Covering 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 |
---|---|
115 | |
100 | |
88 | |
68 | |
61 |
User | Count |
---|---|
152 | |
120 | |
102 | |
87 | |
68 |