Forum Discussion
Reference a Price from the same Table
- 3 years ago
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