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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
zaka88
Frequent Visitor

find values at max and min date in matrix

hi

 

i have 2 tables in pbi data model

table 1
id
group 1
group 2
date

 

table 2
id
value

 

one-to-one relation by id, so i can asume it is one table :

table 1
id
group 1
group 2
date
value

 

and i have matrix visual where i want to find value at min date(min date value) and at max date(max date value):

group 1group 2datevaluemin date valuemax date value
13301.01.2020100100400
13302.01.2020200100400
13303.01.2020300100400
13304.01.2020400100400
24401.01.2020350350333
24402.01.2020555350333
24403.01.2020666350333
24404.01.2020333350333
27703.01.2020160160280
27704.01.2020280160280

 

also i have date filter. for example if user selects just one 2 dates in filter (3-4.01.2020) the measure should be recalculated and display next result:

 

group 1group 2datevaluemin date valuemax date value
13303.01.2020300300400
13304.01.2020400300400
24403.01.2020666666333
24404.01.2020333666333
27703.01.2020160160280
27704.01.2020280160280

 

 

it is should be the matrix viisual, where in Rows we have:

table 1[group 1],table 1[group 2],table 1[date]

and in Values:

table 2[value] and new measures for min\max values

 

example of data:

table 1   
idgroup 1group 2date
113301.01.2020
213302.01.2020
313303.01.2020
413304.01.2020
524401.01.2020
624402.01.2020
724403.01.2020
824404.01.2020
927703.01.2020
1027704.01.2020

 

table 2 
idvalue
1100
2200
3300
4400
5350
6555
7666
8333
9160
10280

 

 

 

 

need help with how to create measure for that. thanks

1 ACCEPTED SOLUTION

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

11 REPLIES 11
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

yeah, thats cool, thanks.

but if you select just few dates in  filter it shows you wrong result.

 

zaka88_3-1617955015022.png

 

 

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

that's exactly what i need.
thank you!

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
ryan_mayu
Super User
Super User

@zaka88 

I noticed that your value and date are in the separate table. How can you identify which value for which date?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




thanks for this question.
actually we have relation one-to-one by ID between this 2 tables. but i changed task description to clarify that.

@zaka88 

is below your matrix visual or table?

group 1 group 2 date value min date value max date value
1 33 01.01.2020 100 100 400
1 33 02.01.2020 200 100 400
1 33 03.01.2020 300 100 400
1 33 04.01.2020 400 100 400
2 44 01.01.2020 350 350 333
2 44 02.01.2020 555 350 333
2 44 03.01.2020 666 350 333
2 44 04.01.2020 333 350 333
2 77 03.01.2020 160 160 280
2 77 04.01.2020 280 160 280

 

if it's a matrix visual, could you please provide the sample data for both table?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




updated

@zaka88 

please can try this

min date value = 
VAR _mindate=CALCULATE(min('Table 1'[date]),ALLEXCEPT('Table 1','Table 1'[group 2]))
return maxx(FILTER(all('Table 1'),'Table 1'[date]=_mindate&&'Table 1'[group 2]=max('Table 1'[group 2])),RELATED('Table 2'[value]))

max date value = 
VAR _maxdate=CALCULATE(max('Table 1'[date]),ALLEXCEPT('Table 1','Table 1'[group 2]))
return maxx(FILTER(all('Table 1'),'Table 1'[date]=_maxdate&&'Table 1'[group 2]=max('Table 1'[group 2])),RELATED('Table 2'[value]))

 

please see the attachment below.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




thanks, it works without date filter.

if i want select just few dates - it displays wrong result.

 

zaka88_1-1617954682612.png

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Solution Authors