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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors