The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event! Join us in Stockholm, Sweden from September 24-27, 2024.
2-for-1 sale on June 20 only!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi,
Below is the table in which I want to count number of Units in a building using a measure if possible.
Building ID | Unit Type |
101 | L1 |
101 | L2 |
101 | L3 |
101 | L4 |
101 | L5 |
101 | L6 |
101 | L7 |
102 | L1 |
102 | L2 |
102 | L3 |
102 | L4 |
102 | L5 |
And I want the measure to count as below :
Building ID | No. of Unit |
101 | 7 |
102 | 5 |
Solved! Go to Solution.
Hi @Anonymous ,
Please try to create a measure with below dax formula:
No.of Unit =
VAR _id =
SELECTEDVALUE ( 'Table'[Building ID] )
VAR tmp =
FILTER ( ALL ( 'Table' ), [Building ID] = _id )
VAR _val =
CALCULATE ( COUNT ( 'Table'[Unit Type] ), tmp )
RETURN
_val
Please refer the attached .pbix file.
Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
Please try to create a measure with below dax formula:
No.of Unit =
VAR _id =
SELECTEDVALUE ( 'Table'[Building ID] )
VAR tmp =
FILTER ( ALL ( 'Table' ), [Building ID] = _id )
VAR _val =
CALCULATE ( COUNT ( 'Table'[Unit Type] ), tmp )
RETURN
_val
Please refer the attached .pbix file.
Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous
No. of Unit = COUNT(Table[Unit Type])
#####################################
No. of Unit 1 =
calculate([No. of Unit],ALLEXCEPTE(TableName,Table[Building ID]))
################################################
No. of Unit 2 =
calculate(COUNT(Table[Unit Type]),ALLEXCEPTE(TableName,Table[Building ID]))
If this post helps, then please consider accepting it as the solution to help other members find it more quickly.THANK YOU!!
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
100 | |
94 | |
80 | |
63 | |
56 |
User | Count |
---|---|
248 | |
122 | |
110 | |
77 | |
70 |