Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi all need help to find the distinct count from a same column between two dates. In the below data May month has X1,X2,X3,X4 &X5 and June month has X1,X2,X3 & X6. So X6 is the new number and the count is 1 for the month of June. Kindly help.
DateTool
01-05-2020 | X1 |
01-05-2020 | X2 |
01-05-2020 | X3 |
01-05-2020 | X4 |
01-05-2020 | X5 |
20-06-2020 | X1 |
20-06-2020 | X2 |
20-06-2020 | X3 |
20-06-2020 | X6 |
Solved! Go to Solution.
@harshagraj try following measure
New Count =
VAR __firstDate = EOMONTH ( MAX ( Table[Date] ), -1 ) + 1
VAR __prevTools = CACLULATETABLE ( VALUES ( Table[Tool] ), Table[Date] < __firstDate )
RETURN
CALCULATE (
COUNTROWS ( Table ),
EXCEPT ( VALUES ( Table[Tool] ), __prevTools )
)
Most likely need bit of tweaking but yo have the gist.
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@harshagraj don't remember but change it like this
New Count =
VAR __firstDate = EOMONTH ( MAX ( Table[Date] ), -1 ) + 1
VAR __prevTools = CACLULATETABLE ( VALUES ( Table[Tool] ), Table[Date] < __firstDate )
RETURN
CALCULATE (
DISTINCTCOUNT ( Table[Tool] ),
EXCEPT ( VALUES ( Table[Tool] ), __prevTools )
)
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@harshagraj try following measure
New Count =
VAR __firstDate = EOMONTH ( MAX ( Table[Date] ), -1 ) + 1
VAR __prevTools = CACLULATETABLE ( VALUES ( Table[Tool] ), Table[Date] < __firstDate )
RETURN
CALCULATE (
COUNTROWS ( Table ),
EXCEPT ( VALUES ( Table[Tool] ), __prevTools )
)
Most likely need bit of tweaking but yo have the gist.
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@harshagraj not fully sure what you are looking for, can you share sample excel file and expected output. Thanks!
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi @parry2k the solution you provided is working but it is giving me the count of tools but i need distinct counts.
@harshagraj don't remember but change it like this
New Count =
VAR __firstDate = EOMONTH ( MAX ( Table[Date] ), -1 ) + 1
VAR __prevTools = CACLULATETABLE ( VALUES ( Table[Tool] ), Table[Date] < __firstDate )
RETURN
CALCULATE (
DISTINCTCOUNT ( Table[Tool] ),
EXCEPT ( VALUES ( Table[Tool] ), __prevTools )
)
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi @parry2k i have a small problem now. Can this calculation be done on Tool context? Like All except (Tool).
The problem what is happening is in the month of Nov 2019 when i export the data i have only 81 tool no's but when i check in Power BI as count of tool it shows 266.
14-01-2020 | |
14-01-2020 | 1944653 |
14-01-2020 | 1829492 |
14-01-2020 | 1829990 |
14-01-2020 | 1949860 |
14-01-2020 | 1949861 |
14-01-2020 | 1880739 |
14-01-2020 | 1880739 |
14-01-2020 | 1880739 |
14-01-2020 | 1880894 |
14-01-2020 | xxxxxxx |
31-01-2020 | |
31-01-2020 | 1944653 |
31-01-2020 | 1829492 |
31-01-2020 | 1947977 |
31-01-2020 | 1949296 |
31-01-2020 | 1951637 |
31-01-2020 | 1952268 |
31-01-2020 | 1952269 |
31-01-2020 | 1952270 |
31-01-2020 | 1952360 |
21-02-2020 | 1949786 |
21-02-2020 | 1949786 |
21-02-2020 | 1952878 |
21-02-2020 | 1952878 |
21-02-2020 | 513002 |
21-02-2020 | 3704900 |
21-02-2020 | 1880816 |
21-02-2020 | 1950063 |
21-02-2020 | xxxxxxx |
28-02-2020 | |
28-02-2020 | 1944653 |
28-02-2020 | 1945212 |
28-02-2020 | 1945212 |
28-02-2020 | 1945212 |
28-02-2020 | 1945212 |
28-02-2020 | 1945212 |
28-02-2020 | 1945212 |
28-02-2020 | 1945213 |
28-02-2020 | 1945213 |
28-02-2020 | 1949786 |
28-02-2020 | 1949786 |
28-02-2020 | 1949786 |
28-02-2020 | 1952878 |
28-02-2020 | 1952878 |
28-02-2020 | 513002 |
28-02-2020 | 3704900 |
28-02-2020 | 1880816 |
28-02-2020 | 1950063 |
Hi @harshagraj ,
What is X1, X2 X3.. in your sample data.
Can you share .pbix file pls.
Regards,
Harsh Nathani
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.