Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi,
How can I do sum and countifs in Power BI.
I have a following column are item, id type, colour code text in my Table and I would like to get the unique count based those columns.
I am able to count by using below mentioned DAX code but I don't how can I do sum and index in my exciting DAX code.
In Excel I am applying the following formula and I would like to get the same thing in PBI. Could you please provide the DAX solution.
D3=SUM(INDEX(1/COUNTIFS(A$3:A$101,A3,B$3:B$101,B3,C$3:C$101,C3),0))
Herewith attached the PBI for your reference.
https://www.dropbox.com/s/6viom43bcbfrklo/SUM%20INDEX%20COUNTIFS.pbix?dl=0
Solved! Go to Solution.
@Saxon10 ,for your reference,
= 1 / COUNTROWS(
FILTER(
'Table',
'Table'[Item] = EARLIER( 'Table'[Item] )
&& 'Table'[Id Type] = EARLIER( 'Table'[Id Type] )
&& 'Table'[Colour Code Text] = EARLIER( 'Table'[Colour Code Text] )
)
)
Another piece of advice on Excel formula, using Structured Reference makes formula readable and dynamic. Structured Reference is one of the most elegant features of Excel.
| Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
@Saxon10 ,for your reference,
= 1 / COUNTROWS(
FILTER(
'Table',
'Table'[Item] = EARLIER( 'Table'[Item] )
&& 'Table'[Id Type] = EARLIER( 'Table'[Id Type] )
&& 'Table'[Colour Code Text] = EARLIER( 'Table'[Colour Code Text] )
)
)
Another piece of advice on Excel formula, using Structured Reference makes formula readable and dynamic. Structured Reference is one of the most elegant features of Excel.
| Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
Thanks for your reply and help.
Your solution is working well.
I try to make structured references formula so it's easy to read it.
Thanks for your reply. Here is the data for your reference.
Herewith attached the PBI for your reference
https://www.dropbox.com/s/6viom43bcbfrklo/SUM%20INDEX%20COUNTIFS.pbix?dl=0
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 48 | |
| 43 | |
| 39 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 68 | |
| 63 | |
| 31 | |
| 30 | |
| 23 |