Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!View all the Fabric Data Days sessions on demand. View schedule
Hello,
I have the table shown, I need a measure (1) that calculates the difference between the earliest two dates
and measure (2) how many times the price changed.
your help is highly appreciated.
@Anonymous
Solved! Go to Solution.
Simple enough,
Cnt =
CALCULATE(
COUNTROWS( 'PRICE' ),
'PRICE'[#]
<= MAXX(
INDEX( 2, DISTINCT( 'PRICE' ), ORDERBY( 'PRICE'[Date], DESC ) ),
'PRICE'[#]
)
) - 1
Expertise = List.Accumulate( {Days as from Today}, {Skills and Knowledge}, (Current, Everyday) => Current & Day.LearnAndPractise(Everyday) ) |
Hi,
PBI file attached.
Hope this helps.
Simple enough,
Cnt =
CALCULATE(
COUNTROWS( 'PRICE' ),
'PRICE'[#]
<= MAXX(
INDEX( 2, DISTINCT( 'PRICE' ), ORDERBY( 'PRICE'[Date], DESC ) ),
'PRICE'[#]
)
) - 1
Expertise = List.Accumulate( {Days as from Today}, {Skills and Knowledge}, (Current, Everyday) => Current & Day.LearnAndPractise(Everyday) ) |
Hi,
I am not sure how your semantic model looksl like but please check the below picture and the attached pbix file.
INDEX function (DAX) - DAX | Microsoft Learn
latest date value vs. second latest date value: =
VAR _t =
FILTER (
ALL ( 'Calendar'[Date] ),
CALCULATE ( SUM ( Data[Price] ) ) <> BLANK ()
)
VAR _latest =
CALCULATE (
SUM ( Data[Price] ),
INDEX ( 1, _t, ORDERBY ( 'Calendar'[Date], DESC ) )
)
VAR _second =
CALCULATE (
SUM ( Data[Price] ),
INDEX ( 2, _t, ORDERBY ( 'Calendar'[Date], DESC ) )
)
RETURN
IF ( HASONEVALUE ( 'ID'[ID] ), _latest - _second )
OFFSET function (DAX) - DAX | Microsoft Learn
price change count: =
VAR _nonblankdate =
FILTER (
VALUES ( 'Calendar'[Date] ),
CALCULATE ( SUM ( Data[Price] ) ) <> BLANK ()
)
VAR _t =
FILTER (
ADDCOLUMNS (
SUMMARIZE ( Data, 'Calendar'[Date] ),
"@current", CALCULATE ( SUM ( Data[Price] ) ),
"@prev",
CALCULATE (
SUM ( Data[Price] ),
OFFSET ( -1, _nonblankdate, ORDERBY ( 'Calendar'[Date], ASC ) )
)
),
[@prev] <> BLANK ()
)
RETURN
IF (
HASONEVALUE ( 'ID'[ID] ),
COUNTROWS ( FILTER ( _t, [@current] <> [@prev] ) )
)
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!