Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
julesdude
Post Partisan
Post Partisan

Need help creating additional rows in matrix table that fall under two criteria

Hi all,

I have the following two tables in my data model:

Table1 - Leases

Asset ReferenceLease ReferenceUnit ReferenceCommencement DateExpiration DateTermination DateLease EndedUnit Start DateUnit End DateUnit Ended
REF01S007REF01-2001-Dec-1431-Dec-2131-Dec-21True31-Jan-22 False
REF01S023REF01-1901-Mar-2228-Feb-29 False01-Jan-21 False
REF01S021REF01-1801-Jan-2131-Dec-32 False01-Jan-21 False
REF01S017REF01-1711-Oct-1931-Mar-26 False11-Oct-19 False
REF01S015REF01-1501-Oct-1130-Sep-23 False01-Oct-11 False
REF01S014REF01-1401-Jan-1231-Dec-2031-Dec-20True01-Jan-1231-Dec-20True
REF01S013REF01-1301-Apr-1331-Mar-26 False01-Apr-13 False
REF01S012REF01-1201-Apr-1231-Mar-24 False01-Apr-12 False
REF01S011REF01-1101-Sep-1131-Aug-23 False01-Sep-11 False
REF01S010REF01-1001-Sep-1331-Aug-27 False01-Sep-13 False
REF01S009REF01-0915-May-1814-May-30 False15-May-18 False
REF01S020REF01-0801-Jul-2030-Jun-32 False01-Jul-20 False
REF01S008REF01-0801-Sep-1531-Aug-2730-Jun-20True01-Jul-20 False
REF01S007REF01-0701-Dec-1431-Dec-2131-Dec-21True01-Dec-14 False
REF01S024REF01-0704-Feb-2203-Feb-28 False01-Dec-14 False
REF01S006REF01-0601-Apr-1931-Dec-2031-Dec-20True01-Jan-21 False
REF01S022REF01-0601-Jan-2131-Dec-32 False01-Jan-21 False
REF01S005REF01-0515-Jun-1730-Nov-2730-Jun-20True01-Jul-20 False
REF01S019REF01-0501-Jul-2030-Jun-32 False01-Jul-20 False
REF01S004REF01-0415-Jun-1714-Jun-2930-Jun-20True01-Jul-20 False
REF01S018REF01-0401-Jul-2030-Jun-3330-Jun-22True01-Jul-20 False
REF01S025REF01-0401-Jul-2230-Jun-35 False01-Jul-20 False
REF01S003REF01-0308-Aug-1807-Aug-3002-Dec-21True08-Aug-18 False
REF01S002REF01-0201-Aug-1522-Nov-2122-Nov-21True01-Aug-15 False
REF01S001REF01-0101-Sep-1831-Aug-30 False01-Sep-18 False

 

Table2 - Units

Asset ReferenceUnit ReferenceUnit NumberUnit Start DateUnit End Date
REF01REF01-092015-May-18 
REF01REF01-031308-Aug-18 
REF01REF01-011101-Sep-18 
REF01REF01-081901-Jul-20 
REF01REF01-051601-Jul-20 
REF01REF01-0414+1501-Jul-20 
REF01REF01-061701-Jan-21 
REF01REF01-021201-Aug-15 
REF01REF01-2018.231-Jan-22 
REF01REF01-0718.101-Dec-14 
REF01REF01-1338-39-40-4101-Apr-13 
REF01REF01-123701-Apr-12 
REF01REF01-113601-Sep-11 
REF01REF01-103501-Sep-13 
REF01REF01-184201-Jan-21 
REF01REF01-194301-Jan-21 
REF01REF01-1442-4301-Jan-1231-Dec-20
REF01REF01-15Antenna01-Oct-11 
REF01REF01-1738-39-40-41 (board)11-Oct-19 

 

I have merged the Unit Start Date and Unit End Date columns of Table2 into Table1 using Power Query and created in Table1 two boolean columns which say whether a lease has ended (Expiration Date is in the past or Termination Date is in the past from today's date) or unit has ended (Unit End Date is in the past).

In my report, I want to list everything as it appears in Table 1 into a Matrix Table visualisation. However, I don't want to display any rows where Lease Ended is True or Unit Ended is True. That's fine - as I can use the filter in the report to filter these out.

However, what my table doesn't show is that although a Unit Number may have a lease that has come to an end or been terminated, the unit still exists (there is no Unit End Date against it) and so it is vacant. I want the report to show 'vacant' as the Lease Reference in this case. 

What would be the best approach to do this? Is it a case of adding a column for Table2 to show whether that unit has no lease dates still current and then somehow referencing this status to create the row? Do i need to create a table entirely in DAX to achieve this?

In my report I'm getting a list of 15 items showing the Asset Reference, Unit Reference and Lease Reference against it - but these are all active leases. There are 3 more rows that I want showing for the 3 units that are there but have no active leases against them and are vacant.

2 REPLIES 2
v-mengzhu-msft
Community Support
Community Support

Hi @julesdude ,

 

I'm sorry but I'm not sure I fully understand what you are saying, it might be easier for me to understand your needs if you could attach a picture of what you want the intended effect to be.

 

Best regards,

Community Support Team Selina zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Hi @v-mengzhu-msft 

Thanks for responding. I think the best way to tackle this is to create a DAX column or measure (whichever makes more sense) with the following logic:

1. Take the Asset Reference 

2. Take the Unit Reference 

3. Filter by Asset Reference and Unit Reference so that it matches the same Asset Reference and Unit Reference for that row, and filter Unit Ended column by False results

4. For the above filtered results, count number of 'True' results from column [Lease Ended]

5. Return count number

 

This way if there is a count number greater than 0 we know that for this asset's unit number, the unit is not ended, and we have a Lease Ended = True (a end lease date or terminated lease date is in the past relative to today's date).

How do I achieve this in DAX?

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.