Forum Discussion
SQL logic in DAX
- 5 years ago
Hi BishwaR ,
Just use Count() directly to create measure:
Count Suborders = COUNT('Table'[Suborder])Attached the sample file in the below, hopes it could help.
Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
How does that look in the data model? Do you have one table with the PO and one table with the Suborders and they are connected with a relationship?
Or do you have one table for the Suborders with a column for the PO?
The reason I'm asking is that different data models need different approaches. If you could show a picture of the data model and the tables that would help a lot. Then I can tell you the measure.
Best regards
Denis
It is a single fact table that contains the both PurchaseOrders and the SubPurchaseOrders. So the PurchaseOrders repeats many times for each SubPurchaseOrder but there are a few PurchaseOrders that have only one SubPurchaseOrder, that is the reason I had to do a distinctcount on PurchaseOrders. For example:
PO 22 SubPO 1
PO22 SubPO 3
PO22 SubPO 4
PO 33 SubPO 1
While counting the SubPO we have to count based on the PO. SubPO1 repeats twice but they belong to two different POs so we have to count each one of them.
Thanks