Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi
I have a table with customer and one with orders, which is related.
I my report, I view all customers having orders where some criteria is set for the order.
I need to add a column where I count all the orders (not filtered) for each customer.
Thanks in advance
Solved! Go to Solution.
Hi @joki ,
If you want a measure. Please try this.
Measure = COUNTROWS('core_crm RecurringCharge')
If you want a calculated column. Because some functions cannot be used under direct query, you need to convert the storage method of the table first. Note that this operation is irreversible, you can consider whether to use it according to the situation.
Please create this calculated column in table 'core_crm Contact'.
Column = CALCULATE(COUNTROWS('core_crm RecurringCharge'))
Attaching the PBIX file for reference, hope this helps.
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data
Hi @joki ,
If you want a measure. Please try this.
Measure = COUNTROWS('core_crm RecurringCharge')
If you want a calculated column. Because some functions cannot be used under direct query, you need to convert the storage method of the table first. Note that this operation is irreversible, you can consider whether to use it according to the situation.
Please create this calculated column in table 'core_crm Contact'.
Column = CALCULATE(COUNTROWS('core_crm RecurringCharge'))
Attaching the PBIX file for reference, hope this helps.
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data
I have now changes to "Import" (not direct query)
I try to create the meassure in "modelling data" but get the same error "Can't find 'core_crm Contact'[ContactId]
Thanks I did someting like that before. I get the error "Can't fint customertable[customer]" (customer)
customertable[customer] must be renamed depending the name of your data.
It is TABLE[column_name] so in your case it would be the dimension table and the column with every customer name appearing only once.
Best regards,
I know I have done that
If you are calculating this column in your DIMENSION table which is customertable it should work.
Otherwise share your data model because I probably miss something.
Best regards,
Hi
Please see below. The issue is between "Contact" and "RecurringCharge"
I just wrote "Customer" and "Order" to simplify
Then I can't use direct query right ?
Sorry, I did not understand that yo uwere using direct query.
Yes you can but before creating the column click on the Fields panel (with every column measure etc) and select the right table (here customertable).
If it is not working I do not have an answer anymore 😞
Best regards,
PS: i looked on the microsoft documentation and created column with direct queries can not refer to multiple table....
Using DirectQuery in Power BI - Power BI | Microsoft Docs
Part modeling limitation
It looks like you are creating your column in the wrong place since when you create a column in the display screen it does not go always right.
Go on modelling data :
then select the right table and here create a column.
Tell me if it works
Best regards,
Hey @joki,
It would be something like :
Count_order_by_custo = Calculate(COUNTROWS(ordertable),
Filter(ALL(ordertable),
customertable[customer] == ordertable[customer]))
This column must be created in your DIMENSION table (customer)
Best regards,
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
21 | |
21 | |
19 | |
13 | |
12 |
User | Count |
---|---|
42 | |
28 | |
23 | |
22 | |
22 |