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
kormosb
Helper III
Helper III

DAX help

Hi,

 

I would like to ask for help with the following:

 

I'd like to calculate cumulative result with TOTALYTD. The topic is testing.

I have the following table:

idtest execution datestatus
12020.01.01failed
12020.01.02success
22020.01.01success

 

I have this calculation:

CALCULATE(TOTALYTD(DISTINCTCOUNT('table'[id]),dim_date[Date]))

 

The result I get is for 2020.01.01 is 1 failed and 1 success (sum 2), which is fine. 

The problem is for 2020.01.02, where my cumulative result is 1 failed and 2 success (sum 3). But I would like to get 2 successes, as the 'id-1' was tested again and turned out to be successful) and id-2 as successful.

 

So basically if an [id] was tested again I don't want to add it to a cumulative results, just the last tested one.

 

Thanks for your help in advance.

 

Kind regards,

Benjamin

 

 

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

Hi @kormosb ,

 

Based on your description, you can create some measures as follows.

  1. Create measures.

 

Latest Execution Status =

var x1=MAXX(FILTER(ALL(table4),[id]=SELECTEDVALUE(table4[id])),[test execution date])

return

MAXX(FILTER(ALL(table4),[id]=SELECTEDVALUE(table4[id])&&[test execution date]=x1),[status])

 

Latest execution date = MAXX(FILTER(ALL(table4),[status]=[Latest Execution Status]&&[id]=SELECTEDVALUE(table4[id])),[test execution date])

 

  1. Create a table visual.

v-yuaj-msft_0-1606351427046.png

 

Result:

v-yuaj-msft_1-1606351427049.png

 

Hope that's what you were looking for.

Best Regards,

Yuna

 

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

3 REPLIES 3
v-yuaj-msft
Community Support
Community Support

Hi @kormosb ,

 

Based on your description, you can create some measures as follows.

  1. Create measures.

 

Latest Execution Status =

var x1=MAXX(FILTER(ALL(table4),[id]=SELECTEDVALUE(table4[id])),[test execution date])

return

MAXX(FILTER(ALL(table4),[id]=SELECTEDVALUE(table4[id])&&[test execution date]=x1),[status])

 

Latest execution date = MAXX(FILTER(ALL(table4),[status]=[Latest Execution Status]&&[id]=SELECTEDVALUE(table4[id])),[test execution date])

 

  1. Create a table visual.

v-yuaj-msft_0-1606351427046.png

 

Result:

v-yuaj-msft_1-1606351427049.png

 

Hope that's what you were looking for.

Best Regards,

Yuna

 

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

vivran22
Community Champion
Community Champion

Hey @kormosb ,

 

You may try:

Count = COUNTAX(VALUES('Table'[id]),1)
 
Result:
 
image.png
 

Hey,

The table was a short example, I am not trying to calculate the cumulative result of the id-1, I would like a general sulition. I definitely need a cumulative DAX formula, something like totalytd.

Kind regards,

Benjamin

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.