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 community -- I have a table below, and I need to calculate the last column as a custom measure/custom column. I'm grateful for any advice concerning the formulae. Please note this is a single table. The last column counts the number of rows which have as PID, the respective row's UID.
ID | PID | Count rows |
1 | 2 | |
2 | 1 | 1 |
3 | 1 | 0 |
4 | 0 | |
5 | 2 | 0 |
Many thanks for considering my request.
Best wishes,
Bogdan Ciocoiu
Solved! Go to Solution.
I found the answer:
Create a second identical SharePoint list and use the below.
Additional column =
calculate (
COUNTROWS('SharePoint list (replica)'),
FILTER('SharePoint list (replica)','SharePoint list (replica)'[PID]='SharePoint list'[ID])
)
Best wishes,
Bogdan Ciocoiu
I can confirm that by creating a second Power BI data set (by loading, again, the same SP list) works.
Best wishes,
Bogdan Ciocoiu
I found the answer:
Create a second identical SharePoint list and use the below.
Additional column =
calculate (
COUNTROWS('SharePoint list (replica)'),
FILTER('SharePoint list (replica)','SharePoint list (replica)'[PID]='SharePoint list'[ID])
)
Best wishes,
Bogdan Ciocoiu
Step 1: Create a summarized table to fetch the count of PID
Hello,
Can someone confirm what the syntax would be if PID and UID were columns in the same SharePoint list, please? I think this is the key.
Count Measure =
VAR __id = MAX ( PID[ID] )
RETURN
CALCULATE (
COUNTROWS ( PID ),
ALL ( PID ),
TREATAS ( { __id }, PID[PID] )
) + 0
Hello Parry, thank you for your swift reply. I'm facing a few challenges due to my setup being slightly different from the one presented above. I'm using Power BI Desktop 2.83, and I'm pulling data from a SharePoint site. My columns are not titled ID and PID; for me to call them, I would have to use something like:
'SharePoint list name'[PID column name] instead of PID
When I start converting this MAX ( PID[ID] ), I get the red error market under PID(ID), and no matter how I refer to my actual column title, I can't seem to be able to get rid of the error. I tried:
'SharePoint list name'[PID column name] ['SharePoint list name'[ID column name] ]
Is there an alternative way, I might be able to pull this off, without calling this syntax: PID[ID]?
Thank you,
Bogdan Ciocoiu
@Bogdan-Ciocoiu add following measure
Count Measure =
VAR __id = MAX ( PID[ID] )
RETURN
CALCULATE (
COUNTROWS ( PID ),
ALL ( PID ),
TREATAS ( { __id }, PID[PID] )
) + 0
Check my latest blog post Year-2020, Pandemic, Power BI and Beyond to get a summary of my favourite Power BI feature releases in 2020
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to 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.
I think the issue is that my MAX() accepts only one column as parameter, while you're saying MAX (PID[ID]) and I don't think that PID[ID] works with SharePoint lists. Can you confirm, please how would the entire syntax look like with SharePoint lists?
Bogdan
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 |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |