Hi jaehun Park,
You can have two strategies.
- Create the report in real-time
In that case, you don’t need to have your Count_Asset entity
You can create a non-persistent entity that will contain the data for your graph with attributes like Month, ItenType, RepairCount, and RentalCount
In this case, you can have adjustments in the previous month too. Think of the following: Is Repair.Date the date it was sent to repair or when it was received back? If the first, will the Repair.Cost already be known? If not, you need to adjust it when the Repair is returned or when you receive the repair offer.
With the real-time option, you consistently report up to date.
- Use calculated values and store them to report on
In that case, you might want to have a persistent entity that you adjust each time you store or change a new repair. The reported accuracy depends of your calculations and changes of that persistent entity
Go for 1 until you see you need to do it differently due to performance reasons.
Change your Domain model to:
An asset can be repaired multiple times, and this Domain Model will support it
The Aggregate list Action will help counting and take the sum of a list
Because you are using an enumeration, you either have to hard-code the enumeration in a flow or use MxModelReflection to get it dynamically. See here for an explanation on the Forum.
If you would be using an Entity AssetType and making a 1:1 association, it would be much easier in the microflow.
If still not clear, comment.
Go Make It