This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
Hi All,
I have created below table at UI. Created to measures (Measure1 & Measure 2) using What If parameter. In Primary/Secoundary column I am assigning value on comparing Measure1 & Measure 2. So I can't replicated the measures as calculated column.
If Measure1 < Measure 2 than Primary else Secoundary
My requirement is to show count of Primary/Secoundarys column in card at UI. So count will come as 2 Primary and 1 Secoundary in individal data cards.
| Resource | Type | ID | Measure1 | Measure2 | Primary/Secoundary |
| abc | Active | 1 | 45 | 67 | Primary |
| ed | Active | 2 | 89 | 45 | Secoundary |
| xyz | Passive | 3 | 21 | 99 | Primary |
If anyone has come across with same scenarieo then please advice how to display the data.
Regards
Vaishali
Solved! Go to Solution.
Hi @Vaishali04
Create a variable table in the DAX measure and then you can use count() function in it.
Try measures like:
Primary Count =
VAR _table = SELECTCOLUMNS('Table',"Resource",'Table'[Resource],"Type",'Table'[Type],"ID",'Table'[ID],"Primary/Secondary",[Primary/Secondary])
VAR _countPrimary = COUNTROWS(FILTER(_table,[Primary/Secondary]="Primary"))
RETURN
_countPrimary
Secondary Count =
VAR _table = SELECTCOLUMNS('Table',"Resource",'Table'[Resource],"Type",'Table'[Type],"ID",'Table'[ID],"Primary/Secondary",[Primary/Secondary])
VAR _countPrimary = COUNTROWS(FILTER(_table,[Primary/Secondary]="Secondary"))
RETURN
_countPrimary
Test result:
Best Regards,
Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.
Hi @Vaishali04 ,
Can you try the below dax in calculated measure and pull it in Card:
For Primary Count:
Primary Count = CALCULATE(COUNT('TableName'[Primary/Secondary]), FILTER(TableName ,MAX(TableName[Primary/Secondary])="Primary")
For Secondary Count:
Secondary Count = CALCULATE(COUNT('TableName'[Primary/Secondary]), FILTER(TableName ,MAX(TableName[Primary/Secondary])="Secondary ")
Give a thumbs up if this post helped you in any way and mark this post as solution if it solved your query !!!
Hi @Anand24
Primary/Secondary column in the table is a measure not a column in table 'TableName'[Primary/Secondary]). So Count(Primary/Secondary) is not valid statement.
Hi @Vaishali04
Create a variable table in the DAX measure and then you can use count() function in it.
Try measures like:
Primary Count =
VAR _table = SELECTCOLUMNS('Table',"Resource",'Table'[Resource],"Type",'Table'[Type],"ID",'Table'[ID],"Primary/Secondary",[Primary/Secondary])
VAR _countPrimary = COUNTROWS(FILTER(_table,[Primary/Secondary]="Primary"))
RETURN
_countPrimary
Secondary Count =
VAR _table = SELECTCOLUMNS('Table',"Resource",'Table'[Resource],"Type",'Table'[Type],"ID",'Table'[ID],"Primary/Secondary",[Primary/Secondary])
VAR _countPrimary = COUNTROWS(FILTER(_table,[Primary/Secondary]="Secondary"))
RETURN
_countPrimary
Test result:
Best Regards,
Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 30 | |
| 24 | |
| 23 | |
| 17 | |
| 16 |
| User | Count |
|---|---|
| 61 | |
| 35 | |
| 30 | |
| 23 | |
| 22 |