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 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
- aake9 years agoFrequent Visitor
Hi v-ljerr-msft
Thx for this solution,
Calculation is not ok, but you showed me how it schould look like.
What i was trying to get this:
WIP = CALCULATE ( COUNTROWS ( Merged_IN_OUT ), FILTER ( Merged_IN_OUT, Merged_IN_OUT[Start] < MAX ( workdays[Workdate] ) ) ) - CALCULATE ( COUNTROWS ( Merged_IN_OUT ), FILTER ( Merged_IN_OUT, Merged_IN_OUT[Shipment] < MAX ( workdays[Workdate] ) && Merged_IN_OUT[LastStatus] = "Shipped" ) )so it works pretty well :)