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,
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.
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.