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
Hello,
Is it possible to calculate distinct count in the measure below? Here is my measure as it stands, which counts the values but I would like to do distinct count of the values.
Measure1=
VAR __table = SUMMARIZE('Table1','Table1'[year],"__value",[Measure2])
RETURN
IF(HASONEVALUE('Table1'[year]), [Measure2],COUNTX(__table,[__value]))E.g. here is measure 2 in action in table visual, which gives measure1 = 4, but I would like measure1 to be 3 in this case.
| Year | Measure2 |
| 2015 | 5 |
| 2016 | 7 |
| 2017 | 7 |
| 2018 | 8 |
Solved! Go to Solution.
See if an adaptation of something like below works:
Measure =
VAR __table = SUMMARIZE('Table2','Table2'[UniqueID],"__value",[Measure2)
VAR __values = DISTINCT(SELECTCOLUMNS(__table,"__value",[__value]))
RETURN
COUNTROWS(__values)
See if an adaptation of something like below works:
Measure =
VAR __table = SUMMARIZE('Table2','Table2'[UniqueID],"__value",[Measure2)
VAR __values = DISTINCT(SELECTCOLUMNS(__table,"__value",[__value]))
RETURN
COUNTROWS(__values)
Thanks @Greg_Deckler that works 🙂 Is it possible to ignore blanks? i.e. not count the rows where values are blank?
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.
| User | Count |
|---|---|
| 47 | |
| 44 | |
| 39 | |
| 20 | |
| 15 |
| User | Count |
|---|---|
| 68 | |
| 68 | |
| 31 | |
| 27 | |
| 24 |