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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
sivasrao
Helper III
Helper III

Last Data Value and Count

Event ActivityEvent TimeTarget 1Target 2
1C100010000
1C100110010
1C100210023
1R100310020
1R100410020
1R100510020
1C100610060
1C100710072
1R100810070
1R100910070

 

Target 1: Whenever R comes, the value of the Time column is the previous value of C (like 1002)

Target 2: Count of R's value saved as the value of the previous C column.

 

Please help with this.

7 REPLIES 7
shrabedi
Frequent Visitor

For Target 1

Target 1 = 
IF('Table'[Event] = "R",
   CALCULATE(
       MAX('Table'[Time]),
       FILTER('Table', 'Table'[Event] = "C" && 'Table'[Time] < EARLIER('Table'[Time]))
   ),
   'Table'[Time]
)

Regards
Accept as a solution if it works.

Thank you for your quick reply.

 Target 2 is the more preferable requirement.

Pls try on this too.

Please elaborate on Target 2.

The count of R values will be assigned to the previous column of the first R.

 

In this example, R will start from the 4th column up to the 6th column. The total Count is 3.

The value 3 will assign to the 3rd column.

 

Same as the 9th and 10th having R, the count is 2. That has been assigned to the 8th column.

 

I hope you understand the requirement.

Anonymous
Not applicable

.

 

Please give proper logic.

Anonymous
Not applicable

Sorry @sivasrao , I wanted the notifications on this thread. Wanted to learn how to solve the same question.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors