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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Find Difference Between Rows in Table based on Criteria

I am trying to calculate the percent change compared to the data for 3/15/20, for each date for each subvertical. Here is an example of the data. The last column is what I am trying to calculate. So for the first row, I need the formula to be 981,000/987,000. Can anyone help me?

 

Sub VerticalDateTotal PunchesDifference from 3/15
Transporation3/8/2020981,00099%
Transporation3/15/2020987,000100%
Transporation3/22/2020890,00090%
Transporation3/29/2020850,00086%
Transporation4/5/2020650,00066%
Hotels3/15/2020675,000100%
Hotels3/22/2020644,00095%
1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I created data to reproduce your scenario.

Table:

d1.PNG

 

You may create a measure as below.

Difference from 3/15 = 
var _denominator = 
CALCULATE(
    SUM('Table'[Total Punches]),
    FILTER(
        ALL('Table'),
        'Table'[Sub Vertical] = SELECTEDVALUE('Table'[Sub Vertical])&&
        'Table'[Date] = DATE(2020,3,15)
    )
)
return
SELECTEDVALUE('Table'[Total Punches])/_denominator

 

Result:

d2.PNG

 

Best Regards

Allan

 

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
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I created data to reproduce your scenario.

Table:

d1.PNG

 

You may create a measure as below.

Difference from 3/15 = 
var _denominator = 
CALCULATE(
    SUM('Table'[Total Punches]),
    FILTER(
        ALL('Table'),
        'Table'[Sub Vertical] = SELECTEDVALUE('Table'[Sub Vertical])&&
        'Table'[Date] = DATE(2020,3,15)
    )
)
return
SELECTEDVALUE('Table'[Total Punches])/_denominator

 

Result:

d2.PNG

 

Best Regards

Allan

 

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

lbendlin
Super User
Super User

try this one:

 

Difference = 
var s = SELECTEDVALUE(Table[Sub Vertical])
var tp315 = CALCULATE(sum(Table[Total Punches]), Table[Sub Vertical]=s, Table[Date]=date(2020,3,15))
return divide(sum(Table[Total Punches]),tp315)

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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

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.