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
kotlonarendra
Frequent Visitor

How to get counts of records for a column based on two date columns

Input: 

 GuideApprovalRequestDateGuideApprovalDate
P1272_NSTwa_N2NozzleSensorSetup_Rev27/1/2021 13:389/30/2021 15:47
P1272_NSTwa_WaferStrandingProcedure_Rev17/1/2021 13:559/30/2021 15:47
P1272_NSTwa_E3DashboardTrace_Rev17/1/2021 13:549/30/2021 15:47
P1272_NSTwa_VortexFlowmeterFlaring_Rev17/1/2021 13:349/30/2021 15:47
P1272_NSTwa_WaferUnStrandingProcedure_Rev17/1/2021 13:569/30/2021 15:47

 

Result: 

 Count GuideApprovalRequestDateCount GuideApprovalDate
9/30/2021 15:4705
7/1/2021 13:3850
1 ACCEPTED SOLUTION
v-chenwuz-msft
Community Support
Community Support

Hi @kotlonarendra ,

 

I don't understand why only one result of GuideApprovalRequestDate is kept in your result, and the others are removed.
This form needs a unique field, if not, then I will sort by GuideApprovalDate.

vchenwuzmsft_1-1655090206320.gif

Unpivot this table.

vchenwuzmsft_2-1655090291944.gif

 

And then get the most date of the current group via this code:

Column =
VAR _a =
    CALCULATE (
        MIN ( 'Table'[Value] ),
        FILTER (
            'Table',
            [GuideApprovalDate] = EARLIER ( 'Table'[GuideApprovalDate] )
                && [Attribute] = "Group.GuideApprovalRequestDate"
        )
    )
RETURN
    IF ( [Attribute] = "Group.GuideApprovalDate", [Value], _a )

 

At last, put this column in the Rows of matrix table and Attribute in the Columns.

vchenwuzmsft_3-1655090780067.png

Result:

vchenwuzmsft_4-1655090805967.png

 

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

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
v-chenwuz-msft
Community Support
Community Support

Hi @kotlonarendra ,

 

I don't understand why only one result of GuideApprovalRequestDate is kept in your result, and the others are removed.
This form needs a unique field, if not, then I will sort by GuideApprovalDate.

vchenwuzmsft_1-1655090206320.gif

Unpivot this table.

vchenwuzmsft_2-1655090291944.gif

 

And then get the most date of the current group via this code:

Column =
VAR _a =
    CALCULATE (
        MIN ( 'Table'[Value] ),
        FILTER (
            'Table',
            [GuideApprovalDate] = EARLIER ( 'Table'[GuideApprovalDate] )
                && [Attribute] = "Group.GuideApprovalRequestDate"
        )
    )
RETURN
    IF ( [Attribute] = "Group.GuideApprovalDate", [Value], _a )

 

At last, put this column in the Rows of matrix table and Attribute in the Columns.

vchenwuzmsft_3-1655090780067.png

Result:

vchenwuzmsft_4-1655090805967.png

 

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

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

kotlonarendra
Frequent Visitor

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