Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
I currently have a table of rental equipment and a list of contracts they were assigned to with dates. My goal is to create a visual that will give me a breakdown of equipment type, the number of units, the number of days avaialbe across all units, and the number of days assigned to contracts across all units within any given date window. Here is my sample pbix.
This is my sample semantic model:
Days Available =
VAR add_date =
SELECTEDVALUE(Units[AddDate])
VAR min_date =
MIN('Calendar'[Date])
VAR start_date =
IF( add_date > min_date, add_date, min_date)
VAR end_date =
CALCULATE(
MAX('Calendar'[Date]),
'Calendar'[Date] <= TODAY(),
KEEPFILTERS('Calendar')
)
VAR available_dates =
DATESBETWEEN('Calendar'[Date], start_date, end_date)
RETURN
COUNTROWS(available_dates)
Days Assigned =
VAR add_date =
SELECTEDVALUE(Units[AddDate])
VAR min_date =
MIN('Calendar'[Date])
VAR start_date =
IF( add_date > min_date, add_date, min_date)
VAR end_date =
CALCULATE(
MAX('Calendar'[Date]),
'Calendar'[Date] <= TODAY(),
KEEPFILTERS('Calendar')
)
VAR available_dates =
DATESBETWEEN('Calendar'[Date], start_date, end_date)
VAR contract_dates =
DATESBETWEEN('Calendar'[Date], SELECTEDVALUE('Lease Contracts'[StartDate]), SELECTEDVALUE('Lease Contracts'[EndDate]))
VAR dates_joined =
NATURALINNERJOIN(available_dates, contract_dates)
RETURN
COUNTROWS(dates_joined)
I've managed to create two unaggregated visuals. One for days available and one for days assigned. However, the measures used to calculate those values require UnitID and ContractID respectively to be accurate. That means they do not work when aggregated by EquipmentType.
This is the general idea of my target visual:
I'm not sure if I need some separate measure that aggregates the first two or if I need to rework the entire approach. I've considered calculated columns, but as far as I know they would not change values based on a date filter/slicer.
Thanks. Much appreciated !
I am trying to build some of the measure now,
but it it is getting late here. So might be tomorrow.
Good night👍
I had a great day thank you and solved other members issues.
If you provide the information requested I will be happy to help you.
Otherwise I hope another Super User helps you.
Perhaps ask a freind, collegaue or manager to see if they can help you reword your description.
Remember, we do want to help now and in the future 😀
Again, the information you requested is in the original post and provided example pbix. However, I'll attempt to highlight the main points and provide tables here if you are unable to view the example file. The measures involved are in the original post.
I have two tables (plus a date table):
Goal:
Create a visual that shows for any date context:
Process:
I have three measures:
These measures work, but not for the target visual that aggregates by equipment type. Therefore, I either need a different approach to these calculations or to add additional steps.
Lease Contracts
ContractID | UnitID | StartDate | EndDate |
1 | 1 | 01/01/2020 | 01/03/2020 |
2 | 1 | 01/04/2020 | 01/04/2020 |
3 | 2 | 01/01/2020 | 01/02/2020 |
4 | 3 | 01/10/2020 | 01/15/2020 |
5 | 3 | 01/16/2020 | 01/20/2020 |
6 | 3 | 02/01/2020 | 02/05/2020 |
7 | 5 | 02/02/2020 | 02/04/2020 |
8 | 4 | 01/10/2020 | 01/15/2020 |
9 | 1 | 01/06/2020 | 01/08/2020 |
10 | 1 | 01/09/2020 | 01/12/2020 |
Units
UnitID | AddDate | EquipmentType |
1 | 01/01/2020 | Truck |
2 | 01/01/2020 | Truck |
3 | 01/05/2020 | Trailer |
4 | 01/09/2020 | Trailer |
5 | 02/02/2020 | Truck |
Example Desired Result for 1/1/2020 - 1/20/2020
EquipmentType | Unit Count | Days Available | Days Assigned | Utilization |
Trailer | 2 | 28 | 17 | 60.7% |
Truck | 2 | 40 | 13 | 32.5% |
If this continues to be unclear, please be specific in what you need. Thank you.
Look forward to helping you when the above information is forthcoming.
Perhaps another member will help you with what you have provided.
I apprecaite it must be frustrating you cant do your can't do your job,
but rememeber we unpaid volunteers who just want to help.
👍
From your first post you have been hostile to me. And now you are blatantly insulting me. I'm sorry if you're having a bad day. I appreciate your attempt to provide assitance, but would suggest if you tell others to be diligent and spend time crafting the perfect post that you also spend time actually reading and understanding that post. Also, I recommend proofreading your responses as they read very unprofessionally (even for an unpaid volunteer). Again, thank you.
We want to help you but your description is too vague.
Please DON'T copy & paste your DAX that does not work and expect us to fathom what you want to do. That is a bit crazy. 😀
Please just give a simple non technical functional description of what you want, then let us suggest the solution. Thank you.
Provide example input data as table text (not a screen print) so we can import the data to build a solution for you.
Remove any unneeded columns which may cause confusion.
(In your description you have devoted 75% of text to proudly explaining whay you have got work and only 25% to the actual problem, which clouds and confusses the issue).
Rename columns to user friendly names. Avoid jargon.
Also provide the example desired output, with a clear step-by-step description of calculations the process flow.
Remember not to share private data ... we don't want you to get into trouble. 😧
Take time and care to use the same table and field names in the input, output and description so we can understand your problem and help you.
Try keep it simple and ask one question per ticket.
You will get a quick response if you put time, care and effort into writing clear problem descriptions.
Remember you are gertting free expert help, so please put lots of proper effort to asking questions and providing examples.
Vaugue descriptions can waste your time and our time.
Look forward to helping you when the above information is forthcoming 😀
Respectfully, I did describe my goal and issues. I linked a simple pbix example of what I'm working with. The dax I linked does work. The next step is what I need help with. "Vaugue descriptions can waste your time and our time." This was far from vague and a time waste. Please be specific in what more information you would like if you are interested in helping. Thank you.
User | Count |
---|---|
141 | |
70 | |
70 | |
53 | |
53 |
User | Count |
---|---|
208 | |
95 | |
64 | |
61 | |
57 |