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
ToPa
New Member

Calculate max value in date range and display only top result

Hi!

 

I have tried to search for similar cases, but can not seem to find the correct solution for creating this measure.

I have two tables - Date Dim and Fact Product. Dim date has date values and Fact Product as below (example data)

(The Value-column is a calculated column and I can not filter Top N by this value in the visual.)

 

IDProductColorValueValue Date
1ABC123Red

300

1/30/24
2ABC123Red4251/30/24
3ABC123Red1501/30/24
4DEF456Blue2252/2/24
5DEF456Blue1502/2/24
6ABC123Red2002/3/24
7ABC123Red1231/28/24
8ABC123Red5001/31/24

 

When selecting a date range from Dim Date in a slicer, I would like to calculate the values for the rows with same product name and color and find which Value Date this was found. I do not want to see all products that date, or all colors - only the one that meet the requirments.

 

Expected result from example 

Selected date range 12/11/23 - 2/3/24 in slicer, visual should display:

ProductColorValueValue Date
ABC123Red8751/30/24

 

If selected date range is 2/2/24 - 2/3-24, visual should display:

ProductColorValueValue Date
DEF456Blue3752/2/24

 

Any idea on how this can be achieved? 🙂

1 ACCEPTED SOLUTION
talespin
Solution Sage
Solution Sage

hi @ToPa 

 

You can use RANK, I have used Date from Fact table, need to check how to use date from Date table in Rank. Apply visual filter on measure rank = 1.

 

Rank =
VAR _Rank =
RANK(
        DENSE,
        ALLSELECTED(TestTbl5[Product], TestTbl5[Color], TestTbl5[Value Date]),
        ORDERBY( [Sum Value], DESC)
)
 
RETURN _Rank
 
talespin_0-1707313607291.png

 

View solution in original post

1 REPLY 1
talespin
Solution Sage
Solution Sage

hi @ToPa 

 

You can use RANK, I have used Date from Fact table, need to check how to use date from Date table in Rank. Apply visual filter on measure rank = 1.

 

Rank =
VAR _Rank =
RANK(
        DENSE,
        ALLSELECTED(TestTbl5[Product], TestTbl5[Color], TestTbl5[Value Date]),
        ORDERBY( [Sum Value], DESC)
)
 
RETURN _Rank
 
talespin_0-1707313607291.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.