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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

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
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.