Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowJuly 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more
Hi,
I am trying to achive a measure in which Price of the select the month should be displayed, if the Price is not available in that month then it should show case the Next available price
I have Used a unlink calendar for the reference Month Year selection
This is the Requirement:
| Material | plant | Customer | Date | Sales Price | Reference Price 1-03-2020 |
| M0001 | P001 | CSM001 | 01-01-2020 | 90 | 69 |
| M0001 | P001 | CSM001 | 01-02-2020 | 89 | 69 |
| M0001 | P001 | CSM001 | 01-03-2020 | 69 | 69 |
| M0001 | P001 | CSM001 | 01-06-2020 | 90 | 69 |
| M0001 | P001 | CSM001 | 01-07-2020 | 18 | 69 |
| M0001 | P001 | CSM001 | 01-08-2020 | 82 | 69 |
| M0001 | P001 | CSM001 | 01-09-2020 | 56 | 69 |
| M0002 | P001 | CSM001 | 01-01-2020 | 90 | 64 |
| M0002 | P001 | CSM001 | 01-02-2020 | 99 | 64 |
| M0002 | P001 | CSM001 | 01-07-2020 | 64 | 64 |
| M0002 | P001 | CSM001 | 01-08-2020 | 22 | 64 |
The Measure that i am trying to build:
ReferencePrice = VAR ReferencePeriod = [ReferencePeriod]
VAR ReferenceTable =
SUMMARIZE (
CALCULATETABLE ( ‘Table’, ‘Table’[Date] >= ReferencePeriod, REMOVEFILTERS(Date)),
‘Table’[Plant],
‘Table’[Material],
‘Table’[Customer],
"SalesPrice",
VAR Price =
CALCULATE (
MAX ( ‘Table’[Sales Price] ),
‘Table’[Date] = ReferencePeriod,
REMOVEFILTERS ( DimDate )
)
VAR PriceMPlus1 =
CALCULATE (
MAX ( ‘Table’[Sales Price] ),
‘Table’[Date] = EDATE ( ReferencePeriod, 1 ),
REMOVEFILTERS ( DimDate )
)
VAR PriceMPlus2 =
CALCULATE (
MAX ( ‘Table’[Sales Price] ),
‘Table’[Date] = EDATE ( ReferencePeriod, 2 ),
REMOVEFILTERS ( DimDate )
)
VAR PriceMPlus3 =
CALCULATE (
MAX ( ‘Table’[Sales Price] ),
‘Table’[Date] = EDATE ( ReferencePeriod, 3 ),
REMOVEFILTERS ( DimDate )
)
RETURN
SWITCH (
TRUE (),
NOT ( ISBLANK ( Price ) ), Price,
ISBLANK ( Price ), PriceMPlus1,
ISBLANK ( PriceMPlus1 ), PriceMPlus2,
ISBLANK ( PriceMPlus2 ), PriceMPlus3,
Price
)
)
RETURN
SUMX ( ReferenceTable, [SalesPrice] )
Solved! Go to Solution.
Hi , @Anonymous
According to your description, you want to achive a measure in which Price of the select the month should be displayed, if the Price is not available in that month then it should show case the Next available price.
Here are the steps you can refer to :
(1)This is my test data:
I create a calendar table like this:
(2)We can create a measure like this:
Measure = var _slicer = MIN('Calendar'[Date])
var _has_value =MAXX( FILTER( 'Table' , 'Table'[Date]=_slicer) , [Sales Price])
var _no_value_date = MINX( FILTER('Table' , 'Table'[Date]>_slicer) , [Date])
var _no_value =MAXX( FILTER('Table' , 'Table'[Date] = _no_value_date) , [Sales Price])
return
IF(_has_value=BLANK(),_no_value,_has_value)
(3)Then we can put the measure on the visual and we can meet your need:
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi,
Thanks for the Response it was very Helpful and Has solve the problem 90%, the Price should repeat for all the Months/date as Show cased in Img 2.
I have tried to use AllExcept funtion and All funtion to avoid the Date filter But no Luck.
Img 1
Img 2
Hi , @Anonymous
Thanks for your quick response !
According to your description, you want to show all in your table .
You can try to use this dax code:
Measure = var _slicer = MIN('Calendar'[Date])
var _material= MAX('Table'[Material])
var _has_value =MAXX( FILTER(ALLSELECTED('Table') , 'Table'[Date]=_slicer && 'Table'[Material]=_material) , [Sales Price])
var _no_value_date = MINX( FILTER(ALLSELECTED('Table') , 'Table'[Date]>_slicer && 'Table'[Material]=_material) , [Date])
var _no_value =MAXX( FILTER(ALLSELECTED('Table') , 'Table'[Date] = _no_value_date && 'Table'[Material]=_material) , [Sales Price])
return
IF(_has_value=BLANK(),_no_value,_has_value)
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi , @Anonymous
According to your description, you want to achive a measure in which Price of the select the month should be displayed, if the Price is not available in that month then it should show case the Next available price.
Here are the steps you can refer to :
(1)This is my test data:
I create a calendar table like this:
(2)We can create a measure like this:
Measure = var _slicer = MIN('Calendar'[Date])
var _has_value =MAXX( FILTER( 'Table' , 'Table'[Date]=_slicer) , [Sales Price])
var _no_value_date = MINX( FILTER('Table' , 'Table'[Date]>_slicer) , [Date])
var _no_value =MAXX( FILTER('Table' , 'Table'[Date] = _no_value_date) , [Sales Price])
return
IF(_has_value=BLANK(),_no_value,_has_value)
(3)Then we can put the measure on the visual and we can meet your need:
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.
| User | Count |
|---|---|
| 23 | |
| 23 | |
| 17 | |
| 13 | |
| 13 |
| User | Count |
|---|---|
| 63 | |
| 41 | |
| 39 | |
| 38 | |
| 38 |