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
brlimagu
Frequent Visitor

Filtering data with different dates

I have a table that shows me all process and subprocess that have failed on a certain day (The user use date slicer to choose the date).

 

As you can see in the image below, the query shows all failed subprocess and I need to build a report that shows only the last subprocess executed. Is there any way to do it?

 

image.png

 

Thanks in advance.

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

Hi @brlimagu,

 

Assume table below: 

 

q5.PNG

 

In your scenario, you can create a measure below: 

 

LatestSub = var MaxSubPerID=CALCULATE(MAX('SubProcess'[SbProcess exec_dt]),FILTER('SubProcess','SubProcess'[ProcessID]=MAX('SubProcess'[ProcessID])))
return
CALCULATE(MAX('SubProcess'[Subprocess Name]),FILTER('SubProcess','SubProcess'[SbProcess exec_dt]=MaxSubPerID))

 

w3.PNG

 

By the way, there are two relationships between Process table and LogProcess table, one Process(1)->LogProcess (N), the other Process(1) ->Log Header-> LogProcess (N). I would suggest you delete the relationship between the Process and Log Header, then change cross filter for relationships Process(1)->LogProcess (N) and Log Header(1)-> LogProcess (N) as Both. For more infomation, see: Create and manage relationships in Power BI Desktop.

 

w4.PNG

 

Best Regards,
Qiuyun Yu 

Community Support Team _ Qiuyun Yu
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

6 REPLIES 6
v-qiuyu-msft
Community Support
Community Support

Hi @brlimagu,

 

Assume table below: 

 

q5.PNG

 

In your scenario, you can create a measure below: 

 

LatestSub = var MaxSubPerID=CALCULATE(MAX('SubProcess'[SbProcess exec_dt]),FILTER('SubProcess','SubProcess'[ProcessID]=MAX('SubProcess'[ProcessID])))
return
CALCULATE(MAX('SubProcess'[Subprocess Name]),FILTER('SubProcess','SubProcess'[SbProcess exec_dt]=MaxSubPerID))

 

w3.PNG

 

By the way, there are two relationships between Process table and LogProcess table, one Process(1)->LogProcess (N), the other Process(1) ->Log Header-> LogProcess (N). I would suggest you delete the relationship between the Process and Log Header, then change cross filter for relationships Process(1)->LogProcess (N) and Log Header(1)-> LogProcess (N) as Both. For more infomation, see: Create and manage relationships in Power BI Desktop.

 

w4.PNG

 

Best Regards,
Qiuyun Yu 

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

Untitled.pngimage.png

Hi @brlimagu,

 

Share your .pbix file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ashish_Mathur
Super User
Super User

Hi,

 

I think i can help.  Please share a sample file to work with.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
TomMartens
Super User
Super User

Hey,

 

you can create a calculated column that marks the latest subprocess by using this DAX statement

Is latest date = 
IF('yourtablename'[Subprocess Exec_dt] = 
CALCULATE(
MAX('yourtablename'[Subprocess Exec_dt])
,ALLEXCEPT('yourtablename', 'yourtablename'[Main Process], 'yourtablename'[Subprocess])
)
,"True"
,"False"
)

Then you can use this column to filter the rows, either by using the column on a slicer, or as filter direct applied to the visual.

 

Hope this helps

 

Regards

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Hi @TomMartens thank you for your help, but this works for the entire column and I have a Process table with IDs and a SubProcess table with subprocess related to process, I need to show the latest subprocess for each process ID.

 

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.