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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
PaulHallam
Helper III
Helper III

Use the Date from a measure to look into data table and return a count of values from that table

I have a couple of measures.

//Measure 1 calculates the count of "high" and "medium"per day and returns the maximum

 

Measure 1 =
MAXX(
    KEEPFILTERS(VALUES('Data'[Date])),
    CALCULATE(COUNTA('Data'[Category]),OR ('Data'[Category]="High",(Data[Category]="Medium")
)))


//Measure 2 calculates the date of the highest value from measure 1

 

Measure 2 =
CALCULATE(max(Data[Date]),TOPN(1,allselected(Data[Date]),[H&MbyDate] ,DESC),VALUES(Data[Date]))


I want to look this date up in another table and return the value in another column.

I want to use the date from measure 2 to look into the data table and return the count of just "Medium" on that day. I can't find a way to use the date to do this, is there something wrong with the logic of what i am doing? Are the above measures leading me down the wrong road?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @PaulHallam 

 

The following testing is for your reference.

 

My sample:

 

Data table:

vxuxinyimsft_0-1729229558534.png

 

another table:

vxuxinyimsft_1-1729229641914.png

 

Create a calculated column as follows

 

Column = 
IF (
    'another table'[Date] = [Measure2]
        && 'another table'[Category] = "Medium",
    CALCULATE (
        COUNT ( 'another table'[Category] ),
        FILTER ( 'another table', [Date] = [Measure2] && [Category] = "Medium" )
    )
)

 

 

Output:

vxuxinyimsft_2-1729229896778.png

 

If this sample data is structurally different from the one you are using, please provide some sample data and the desired output based on the sample data so that I can help you better. How to provide sample data in the Power BI Forum - Microsoft Fabric Community

 

Best Regards,
Yulia Xu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @PaulHallam 

 

The following testing is for your reference.

 

My sample:

 

Data table:

vxuxinyimsft_0-1729229558534.png

 

another table:

vxuxinyimsft_1-1729229641914.png

 

Create a calculated column as follows

 

Column = 
IF (
    'another table'[Date] = [Measure2]
        && 'another table'[Category] = "Medium",
    CALCULATE (
        COUNT ( 'another table'[Category] ),
        FILTER ( 'another table', [Date] = [Measure2] && [Category] = "Medium" )
    )
)

 

 

Output:

vxuxinyimsft_2-1729229896778.png

 

If this sample data is structurally different from the one you are using, please provide some sample data and the desired output based on the sample data so that I can help you better. How to provide sample data in the Power BI Forum - Microsoft Fabric Community

 

Best Regards,
Yulia Xu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

PaulHallam
Helper III
Helper III

Measure 2 should read

CALCULATE(max(Data[Date]),TOPN(1,allselected(Data[Date]),[Measure1] ,DESC),VALUES(Data[Date]))

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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
Top Kudoed Authors