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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
BJMaxwell
Regular Visitor

Getting Inference from Multiple Dates

I would be glad if you could help me with this.

 

There are 9 date columns on my log table that refer to 9 process stages against a process number. There is also a summary table that records the current 'stage due date' and the tables are joined by task ID.

The stage due date matches only one of the other 9 process dates (which therefore indicates the current stage on that log table).

 

I want to be able to generate a column on the log table that automatically writes out the current stage (from column 'Stages').

 

For example, in the image below, for process number 40, the current stage is 'Pricing', and for process number 23, the current stage is 'Scope Acknowledgement'. 
I want to be able to auto-generate this in another column.

 

BJMaxwell_0-1675279539684.png

 

 

1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

Hi , @BJMaxwell 

According to your description, you want to add a column to get the current stage by the 'due date' in the summary table.

 I am not surely for the raw data in your side , This is my test data:

vyueyunzhmsft_0-1675303957554.pngvyueyunzhmsft_1-1675303977377.png

[1]If you want to add a calculated column in the LogTable , you can click "New Column" and enter this:

Column = var _due_date = RELATED('SuammaryTable'[stage due date])
var _t =FILTER('LogTable','LogTable'[task ID]=EARLIER('LogTable'[task ID]) && 'LogTable'[Date]=_due_date)
return
MAXX(_t,[Stage])

Then we can meet your need :

vyueyunzhmsft_2-1675304116278.png

 

[2]If you want to add a measure, you can use this dax code:

Measure = var _due_date =MAX('SuammaryTable'[stage due date])
var _id =  MAX('SuammaryTable'[task ID])
var _t = FILTER( ALLSELECTED('LogTable') , 'LogTable'[task ID]=_id && 'LogTable'[Date] =  _due_date)
return
MAXX(_t ,[Stage])

Then we can put the measure on the visual and we can meet your need , the result is as follows:

vyueyunzhmsft_3-1675304255172.png

 

 

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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
Ashish_Mathur
Super User
Super User

Hi,

The primary step should be to "Unpivot Other columns" in the Log table.  Then depending whether you want a measure or a calculated column formula solution, you may use the RELATED()/RELATEDTABLE()/CALCULATE() function.  To get specific help, share data that can be pasted in an MS Excel file and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-yueyunzh-msft
Community Support
Community Support

Hi , @BJMaxwell 

According to your description, you want to add a column to get the current stage by the 'due date' in the summary table.

 I am not surely for the raw data in your side , This is my test data:

vyueyunzhmsft_0-1675303957554.pngvyueyunzhmsft_1-1675303977377.png

[1]If you want to add a calculated column in the LogTable , you can click "New Column" and enter this:

Column = var _due_date = RELATED('SuammaryTable'[stage due date])
var _t =FILTER('LogTable','LogTable'[task ID]=EARLIER('LogTable'[task ID]) && 'LogTable'[Date]=_due_date)
return
MAXX(_t,[Stage])

Then we can meet your need :

vyueyunzhmsft_2-1675304116278.png

 

[2]If you want to add a measure, you can use this dax code:

Measure = var _due_date =MAX('SuammaryTable'[stage due date])
var _id =  MAX('SuammaryTable'[task ID])
var _t = FILTER( ALLSELECTED('LogTable') , 'LogTable'[task ID]=_id && 'LogTable'[Date] =  _due_date)
return
MAXX(_t ,[Stage])

Then we can put the measure on the visual and we can meet your need , the result is as follows:

vyueyunzhmsft_3-1675304255172.png

 

 

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

 

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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