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
filipe
New Member

Add new column with "where" clause

Hi all,

i'm newbie with DAX so your help would be really great.

I have two tables:

TableA: Energy Readings table (once a day I record total Energy consumption per energy counter). Columns: ReadingDate, CounterID, Energytable1.jpg

 

and than I have the Clients Table. Each client may have one or several counters associated (depends on room size...) and StartDate and EndDate. In this Table i'll keep record of old clients (to historize energy consumption), so the relation between this two tables is many-to-many:table2.jpg

 

...My problem here is that i need to keep track of the energy consumption by client.

My idea was to add a new Column to ReadingsTable with the actual client related to the reading date.

It would be something like this:table3.jpg

 

..any ideas on how to have the new column? The logic would be to add Client name with the related client from Client table according to the dates.

Thank you in advance!

1 ACCEPTED SOLUTION
v-jiascu-msft
Employee
Employee

Hi @filipe,

 

It seems the Date and the CounterID can determine a unique row. I would suggest you add such a column. No matter who is using that room, the history can be tracked. It could be like below.

 

ID =
FORMAT ( [ReadingDate], "YYYYMMDD" ) & [CounterID]

 

Best Regards,

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-jiascu-msft
Employee
Employee

Hi @filipe,

 

It seems the Date and the CounterID can determine a unique row. I would suggest you add such a column. No matter who is using that room, the history can be tracked. It could be like below.

 

ID =
FORMAT ( [ReadingDate], "YYYYMMDD" ) & [CounterID]

 

Best Regards,

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you very much!

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.