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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Incorrect no. of POs thru calculate

Dear All,

I am new to Power BI/DAX world. I want to add a column in table named Test PR POS ONLY. The name of column is Count of POs. My DAX command is given below: (which is not giving correct no.)

 

Count of POS =

VAR TotalRowsTestprTable = COUNTROWS('test pr')

RETURN CALCULATE(TotalRowsTestprTable, FILTER('test pr', 'test pr'[PO Date].[Date]='test pr POS ONLY'[PR Date].[Date]))

1. Test Pr table is as below

PR No.PR DatePO DatePO No
1001/01/202001/01/2020110
2002/01/202005/01/2020120
3003/01/202006/01/2020130
4004/01/202007/01/2020140
5005/01/202008/01/2020150
6006/01/202011/01/2020160
7007/01/202007/01/2020170
8008/01/202011/01/2020180
9009/01/202015/02/2020190

 

2. My Test PR POs ONLY table is as below

PR DateCount of POs
01/01/202020
02/01/202020
03/01/202020
04/01/202020
05/01/202020
06/01/202020
07/01/202020
08/01/202020
09/01/202020

 

3. The above no. 20 (which is wrong) is calculated as a result of my DAX command

4. i have 1 to many relation between Test PR POS ONLY table and Test PR tables

Please help where am i making the mistake. Thanks ifti1970@gmail.com

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous ,

New Table =summarize('Test Pr','Test Pr'[PR Date],"Count of POs", Count('Test Pr'[PO No]))

 

New column in the table
Count of POs = countrows(related('Test Pr'[PO No])) //only when it is 1 to M-HIPOTPol
or
Count of POs = countx(filter('Test Pr', 'Test Pr'[PR Date] = 'Test PR POs'[PR Date]),'Test Pr'[PO No])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Greg_Deckler
Community Champion
Community Champion

@Anonymous I believe all you should need is:

 

COUNTROWS(RELATEDTABLE('Table1'))



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.