Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
psilos24
Helper I
Helper I

Measure Problem - Matrix,count if has at least value.

Hello guys,

 

I would like to create a measure and I have tried different techniques but with no luck.

I want to create a measure to count the number of rows based on the following criteria:

 

  • If Period1 has at least a value and period2 has at least value  to count 

OR

  • If Period2 has at least a value and period3 has at least value  to count 

OR

  • If Period1 has at least a value and period3 has at least value  to count
For the example shown below, the answer should be 5 (highlighted rows).
 
 
psilos24_1-1616928646830.png

 

 

2 ACCEPTED SOLUTIONS

@psilos24 

please see the attachment below. hope this is helpful





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

@psilos24 

please see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

8 REPLIES 8
ryan_mayu
Super User
Super User

@psilos24 

is this what you want?

Measure = 
VAR _count=DISTINCTCOUNT('Table (2)'[Period])
return if(sumx(VALUES('Table (2)'[Period]),_count)>1,1, sumx(VALUES('Table (2)'[Period]),_count))

3.PNG

i think this will affect both column total and row total.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@ryan_mayu Thanks for the response, but it seems that is not working right. It showed the number 1 instead of 5 when I put it on the card.

@psilos24 

please try this

Measure = 
VAR _count=distinctcount('Table'[period])
VAR _count2=if(_count>1,1,_count)
return sumx(VALUES('Table'[period]),_count2)

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@ryan_mayu Thanks again for the response, but the answer should be 5 instead of 3.The measure should count the codes (256,258,262,264,269).

Let me remind you that the measure idea is the following.

 

  • If Period1 has at least a value and period2 has at least a value to count. 

OR

  • If Period2 has at least a value and period3 has at least a value to count. 

OR

  • If Period1 has at least a value and period3 has at least a value to count.

@psilos24 

please see the attachment below. hope this is helpful





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@ryan_mayu Thanks a lot. It works great.😊

 

I have something additional if you have the kindness to help me. I also want to create a measure to count the rows that have for sure a value at period 3 and (a value in period 2 OR period1). For this case, the answer should be 3 . (rows 258,262,269)

@psilos24 

please see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@ryan_mayu Thanks a lot !!!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.