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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
sajal161292
Helper V
Helper V

DAX Count Only the first occurence of a measure value

 

Hi,

 

I would like to calculate the first occurence of a measure value...powerbi1.PNG

i.e. i would like to see the value 78 only for the negative Total and should not show the remaining values(77,76,75,74,73,72)  for the negative total.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @sajal161292,

 

I think you can simply add if statement to check row contents and calculate result.(use new formula to calculate on rows who achieve above conditions)

 

Sample:

Customize measure=
VAR current_row =
    SELECTEDVALUE ( Table[Column] )
VAR result = 'original calculate formula'
RETURN
    IF (
        current_row = "Total"
            && reuslt < 0,
        'custom formula for get total',
        result
    )

Notice: please use your formula to replace bold part.

 

Regards,

Xiaoxin Sheng

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @sajal161292,

 

I think you can simply add if statement to check row contents and calculate result.(use new formula to calculate on rows who achieve above conditions)

 

Sample:

Customize measure=
VAR current_row =
    SELECTEDVALUE ( Table[Column] )
VAR result = 'original calculate formula'
RETURN
    IF (
        current_row = "Total"
            && reuslt < 0,
        'custom formula for get total',
        result
    )

Notice: please use your formula to replace bold part.

 

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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