Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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 Date | PO Date | PO No |
10 | 01/01/2020 | 01/01/2020 | 110 |
20 | 02/01/2020 | 05/01/2020 | 120 |
30 | 03/01/2020 | 06/01/2020 | 130 |
40 | 04/01/2020 | 07/01/2020 | 140 |
50 | 05/01/2020 | 08/01/2020 | 150 |
60 | 06/01/2020 | 11/01/2020 | 160 |
70 | 07/01/2020 | 07/01/2020 | 170 |
80 | 08/01/2020 | 11/01/2020 | 180 |
90 | 09/01/2020 | 15/02/2020 | 190 |
2. My Test PR POs ONLY table is as below
PR Date | Count of POs |
01/01/2020 | 20 |
02/01/2020 | 20 |
03/01/2020 | 20 |
04/01/2020 | 20 |
05/01/2020 | 20 |
06/01/2020 | 20 |
07/01/2020 | 20 |
08/01/2020 | 20 |
09/01/2020 | 20 |
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
@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])
@Anonymous I believe all you should need is:
COUNTROWS(RELATEDTABLE('Table1'))
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
47 | |
26 | |
19 | |
14 | |
10 |
User | Count |
---|---|
58 | |
50 | |
44 | |
19 | |
19 |