Forum Discussion
counting rows that are dependent from two different tables
- 9 years ago
Hi aake,
After going over the sample data provided above, I would suggest you to merge "IN" table and "OUT" table into a single table(assume it is called "Merged_IN_OUT") first, then you should be able to use the formula below to create the measure "WIP".
WIP = CALCULATE ( COUNTROWS ( Merged_IN_OUT ), FILTER ( Merged_IN_OUT, Merged_IN_OUT[Start] < MAX ( workdays[Workdate] ) && Merged_IN_OUT[Shipment] < MAX ( workdays[Workdate] ) && Merged_IN_OUT[LastStatus] = "Shipped" ) )Here is the sample pbix file for your reference.
In addition, for more details about how to use Merge Queries in Power BI Desktop, you can refer to the following articles:
POWER BI DESKTOP : MERGE QUERY OPTIONS
Shape and combine data in Power BI Desktop
Regards
Hi aake
The Queen of all the functions in DAX -- You should use CALCULATE function to pass on a filter to your count records.
See this VIDEO from Rob.
Hi Bhavesh,
I tried to use calculate function as new column in first table ( DGS_Calendar it is called - the one with workdays) ind i always have the same problem:
which i don't understand because Countrows parameter is table, and in each filter there is single column.
- BhaveshPatel9 years ago
Super User
- aake9 years agoFrequent Visitor
Hi BhaveshPatel
File samples are in location below
https://1drv.ms/f/s!AgBIHH6nH3zFgtsuaWdtkA5kusSKzw
the idea is to create combo chart where on X is workday and on Y there are values of intake, output and work in progres for each day using data from location
- v-ljerr-msft9 years ago
Microsoft Employee
Hi aake,
After going over the sample data provided above, I would suggest you to merge "IN" table and "OUT" table into a single table(assume it is called "Merged_IN_OUT") first, then you should be able to use the formula below to create the measure "WIP".
WIP = CALCULATE ( COUNTROWS ( Merged_IN_OUT ), FILTER ( Merged_IN_OUT, Merged_IN_OUT[Start] < MAX ( workdays[Workdate] ) && Merged_IN_OUT[Shipment] < MAX ( workdays[Workdate] ) && Merged_IN_OUT[LastStatus] = "Shipped" ) )Here is the sample pbix file for your reference.
In addition, for more details about how to use Merge Queries in Power BI Desktop, you can refer to the following articles:
POWER BI DESKTOP : MERGE QUERY OPTIONS
Shape and combine data in Power BI Desktop
Regards