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

Win a FREE 3 Day Ticket to FabCon Vienna. Apply now

Reply
Anonymous
Not applicable

Count Occurences of a value based on another table

Hi Experts

 

I want to count the number of time Oct 2018 appear in table B, and then number of 1 in column WD in table B based on Table A..

so if i have

Table A             Table B           Table B[column WD]

Oct 2018           Oct 2018        1

Oct 2018           Oct 2018        1

Oct 2018           Oct 2018        0

 

so the answer on the measure formula should be 2..

WorkingDayNumber = CALCULATE(COUNTROWS('Taiwan Data'),'Taiwan Calendar'[Month Year] = 'Taiwan Calendar'[Month Year],DimDate[Month&Year],DimDate[Working Days]=1)
1 ACCEPTED SOLUTION

@Anonymous

 

try following, put a slicer and use table a field on the slicers

 

create a measure for selected valued, you can give default value at following measure in place BLANK()

 

selectedMonth = SELECTEDVALUE( TableA[Month], BLANK() )

measure for count and sum, update table name and field name as per your model. Use card visual and drop "total count" and "total sum" to see the values. Hope it is helpful.

 

Total Count = 
CALCULATE( COUNTROWS( TableB ), FILTER( TableB, TableB[Month] = selectedMonth ) )

Total Sum  =

CALCULATE( SUM( TableB[Column1] ), FILTER( TableB, TableB[Month] = selectedMonth ) )



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.

View solution in original post

5 REPLIES 5
parry2k
Super User
Super User

@Anonymous so you want user to select value from table a and then give count from table b and also sum of "column wd", is this what you want?



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.

Anonymous
Not applicable

Hi Parry2k

 

thanks for the feedback... and YES>

@Anonymous

 

try following, put a slicer and use table a field on the slicers

 

create a measure for selected valued, you can give default value at following measure in place BLANK()

 

selectedMonth = SELECTEDVALUE( TableA[Month], BLANK() )

measure for count and sum, update table name and field name as per your model. Use card visual and drop "total count" and "total sum" to see the values. Hope it is helpful.

 

Total Count = 
CALCULATE( COUNTROWS( TableB ), FILTER( TableB, TableB[Month] = selectedMonth ) )

Total Sum  =

CALCULATE( SUM( TableB[Column1] ), FILTER( TableB, TableB[Month] = selectedMonth ) )



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.

Anonymous
Not applicable

parrk2k...

 

thanks for the feedback, without the slicer would the following work>>

 

WorkingDayNumber = CALCULATE(COUNTROWS('Taiwan Data'),FILTER('Taiwan Data','Taiwan Calendar'[Month Year] = 'Taiwan Calendar'[Month Year]),DimDate[Working Days] =1)
Anonymous
Not applicable

Parrky 2k.,..

 

solved it,......WorkingDayNumber = CALCULATE(COUNTROWS('DimDate'),FILTER(DimDate,DimDate[Month&Year] = 'Taiwan Calendar'[Month Year]),DimDate[Working Days]=1)

 

thanks for you're guidance..

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.