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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi,
I am trying to build a DAX Measure for Count of number of companies has been created after the first invoice
We have invoice creation date(Invoice_Create Date)column and company established date(Company_Create_Date) columns, we just need to check that there is no invoice with this company id(Company ID) on this specific Country Code(Company Code) prior to the company established date.
I tried this measure
Num of invoices created before company established =
var allcompanies = VALUES([Company ID])
var Company_established_date_greater_than_invoice_created_date = CALCULATETABLE(Company ID]),
FILTER (
Table name(),
Table name[Company_Create_Date] > Table name[Invoice_Create_date] )
)
return
COUNTROWS(Except(allCompanies,Company_established_date_greater_than_invoice_created_date)).
How can i relate the Country code with Company ID?
Hi @Anonymous
Please try
Num of invoices created before company established =
SUMX (
SUMMARIZE ( 'Table', 'Table'[Company ID], 'Table'[Country Code] ),
COUNTROWS (
FILTER (
CALCULATETABLE ( 'Table' ),
'Table'[Company_Create_Date] > 'Table'[Invoice_Create_date]
)
)
)Num of companies created after invoice creation =
SUMX (
SUMMARIZE ( 'Table', 'Table'[Company ID], 'Table'[Country Code] ),
IF (
NOT ISEMPTY (
FILTER (
CALCULATETABLE ( 'Table' ),
'Table'[Company_Create_Date] > 'Table'[Invoice_Create_date]
)
),
1
)
)
I need to check both Num of Invoices and num of Companies as well, Primarily i am trying to achieve num of companies/vendors
@Anonymous ,
Assume they are from same table. try this measure
Countx(filter(Summarize(Table, Table[Company], "_1", Min(Table[Invoice_Creation Date]), "_2", Min(Table[Company_Create_Date]) ), [_2] >[_1]), [Company])
I tried this measure,but not showing any Visual
Hi Amit,
Thank You for the response,
But How the company ID is relates to Country Code?
Company Id, Country ID, COmpany Est Date and Invoice created date are belongs to same table.
@Anonymous
Does the Country ID refer to the company or to the invoice?
yes @tamerj1 i need to check, if there is any invoices created with the company id on a specific country code before the company established date.
@Anonymous
Ok. Are you trying to calculate the number of invoices or the number of companies? I'm asking this because the title contradicts with your dax code attempt.
I need both num of invoices and number of companies info but primarily i am working on Number of companies that has been created after the first invoice out of total no of the companies that has been created
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 20 | |
| 10 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 33 | |
| 31 | |
| 19 | |
| 12 | |
| 11 |