Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
I'm trying to show the difference between lowest/highest value of real estate offers next to eachother in one table.
I've got table like this.
advert_number | data_download | price |
111 | 02.01.2020 | 100 |
111 | 03.01.2020 | 200 |
111 | 04.01.2020 | 300 |
… | … | … |
And measures..
Mindate =
CALCULATE(MAX(estate_data[price]), FIRSTDATE(estate_data[date_download]))
Maxdate =
CALCULATE ( max ( estate_data[price] ), LASTDATE(estate_data[date_download]))
But for some reason in few cases I dont see price for min/max date like in this example.
Where I made an error?
Solved! Go to Solution.
Hi @kageyoshi777 ,
I created a sample pbix file(see attachment) for you, please check whether that is what you want. You can update the formula of measure [Mindate] and [Maxdate] as below:
Mindate =
VAR _seladvert =
SELECTEDVALUE ( 'estate_data'[advert_number] )
VAR _mindate =
CALCULATE (
MIN ( 'estate_data'[data_download] ),
FILTER (
ALLSELECTED ( 'estate_data' ),
'estate_data'[advert_number] = _seladvert
)
)
RETURN
CALCULATE (
MAX ( 'estate_data'[price] ),
FILTER (
ALLSELECTED ( 'estate_data' ),
'estate_data'[advert_number] = _seladvert
&& 'estate_data'[data_download] = _mindate
)
)
Maxdate =
VAR _seladvert =
SELECTEDVALUE ( 'estate_data'[advert_number] )
VAR _maxdate =
CALCULATE (
MAX ( 'estate_data'[data_download] ),
FILTER (
ALLSELECTED ( 'estate_data' ),
'estate_data'[advert_number] = _seladvert
)
)
RETURN
CALCULATE (
MAX ( 'estate_data'[price] ),
FILTER (
ALLSELECTED ( 'estate_data' ),
'estate_data'[advert_number] = _seladvert
&& 'estate_data'[data_download] = _maxdate
)
)
If the above one can't help you get the desired result, please provide more sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
Hi,
For these kind of calculations I recommend using thins kind of pattern:
Maxdate =
var _mdate = CALCULATE ( max (estate_data[date_download]),All(estate_data[advert_number]))return
CALCULATE ( max ( estate_data[price] ), all(estate_data[date_download]),estate_data[date_download]=_mdate)
The idea here is to first define the desired date in variable then remove some filter context using all and finally returnin filters to the calculation by using the variable defined. You might need to adjust the variable and ALL to get the desired outcome but the idea remains the same. If you have calendar table instead of using ALL(estate_data[date_download]) in the calculate you can use ALL(calendar).
I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/
Proud to be a Super User!
Hi, this solution does not solve my problem 😑. Of course for some "adverts" it works, like old measures worked too.
But for others still nothing.
In this case I'm not using any data tables etc. Only plain data table like in my first post
Hi @kageyoshi777 ,
I created a sample pbix file(see attachment) for you, please check whether that is what you want. You can update the formula of measure [Mindate] and [Maxdate] as below:
Mindate =
VAR _seladvert =
SELECTEDVALUE ( 'estate_data'[advert_number] )
VAR _mindate =
CALCULATE (
MIN ( 'estate_data'[data_download] ),
FILTER (
ALLSELECTED ( 'estate_data' ),
'estate_data'[advert_number] = _seladvert
)
)
RETURN
CALCULATE (
MAX ( 'estate_data'[price] ),
FILTER (
ALLSELECTED ( 'estate_data' ),
'estate_data'[advert_number] = _seladvert
&& 'estate_data'[data_download] = _mindate
)
)
Maxdate =
VAR _seladvert =
SELECTEDVALUE ( 'estate_data'[advert_number] )
VAR _maxdate =
CALCULATE (
MAX ( 'estate_data'[data_download] ),
FILTER (
ALLSELECTED ( 'estate_data' ),
'estate_data'[advert_number] = _seladvert
)
)
RETURN
CALCULATE (
MAX ( 'estate_data'[price] ),
FILTER (
ALLSELECTED ( 'estate_data' ),
'estate_data'[advert_number] = _seladvert
&& 'estate_data'[data_download] = _maxdate
)
)
If the above one can't help you get the desired result, please provide more sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
21 | |
15 | |
14 | |
11 | |
7 |
User | Count |
---|---|
25 | |
24 | |
12 | |
11 | |
10 |