Forum Discussion

PaulJ185's avatar
PaulJ185
New Member
10 months ago
Solved

Need Help with Dax Calculations | Count Resolved Date only for MAX Week Numbers

Hi There,

 

I wantto countresoved date only for max week which is 45 in my dataset and row count is 3.

 

Expected answer= Resoved Date is 3.

  • Hi PaulJ185 

     

    Assuming week is a measure

    Resolved date with max week - Count = 
    VAR _SummaryTable =
        SUMMARIZECOLUMNS (
            'Table'[Resolved Date],
            "@week", CALCULATE ( SUM ( 'Table'[Week] ) )
        )
    VAR _Max =
        MAXX ( _SummaryTable, [@week] )
    RETURN
    COUNTROWS ( FILTER ( _SummaryTable, [@week] = _Max ) )
    
    Resolved date with max week = 
    VAR _SummaryTable =
        SUMMARIZECOLUMNS (
            'Table'[Resolved Date],
            "@week", CALCULATE ( SUM ( 'Table'[Week] ) )
        )
    VAR _Max =
        MAXX ( _SummaryTable, [@week] )
    RETURN
    MAXX ( FILTER ( _SummaryTable, [@week] = _Max ), [Resolved Date] )
    

     

6 Replies

  • You want to count the number of Resolved Dates only for the maximum week (Week = 45) in your dataset.
    In Power BI (DAX), you can use this measure:

    Resolved Count =

    VAR MaxWeek = MAX('YourTable'[Week])

    RETURN

    COUNTROWS(

        FILTER(

            'YourTable',

            'YourTable'[Week] = MaxWeek

        )

    )

    Explanation:

    • MAX('YourTable'[Week]) → finds the highest week number (45).
    • FILTER() → keeps only rows where [Week] = 45.
    • COUNTROWS() → counts how many rows meet that condition.

    Expected Result:

    Resolved Count = 3

    If you found this post helpful, please consider accepting it as the solution so that other members can find it more easily.

     

    Regards,

    Khashayar Yazdani | Microsoft MCT

    https://www.linkedin.com/in/khashayary/

  • Shahid12523's avatar
    Shahid12523
    Icon for Community Champion rankCommunity Champion

    DAX Measure: Count for Max Week


    ResolvedCount_MaxWeek =
    CALCULATE(
    COUNTROWS('YourTable'),
    FILTER(
    'YourTable',
    'YourTable'[Week] = CALCULATE(MAX('YourTable'[Week]))
    )
    )

  • Resolved Count for Max Week =
    VAR MaxWeek = CALCULATE(MAX('Table'[Week]), ALL('Table'))
    RETURN
    CALCULATE(
    COUNT('Table'[Resolved Date]),
    'Table'[Week] = MaxWeek
    )
  • Hi PaulJ185 

     

    Assuming week is a measure

    Resolved date with max week - Count = 
    VAR _SummaryTable =
        SUMMARIZECOLUMNS (
            'Table'[Resolved Date],
            "@week", CALCULATE ( SUM ( 'Table'[Week] ) )
        )
    VAR _Max =
        MAXX ( _SummaryTable, [@week] )
    RETURN
    COUNTROWS ( FILTER ( _SummaryTable, [@week] = _Max ) )
    
    Resolved date with max week = 
    VAR _SummaryTable =
        SUMMARIZECOLUMNS (
            'Table'[Resolved Date],
            "@week", CALCULATE ( SUM ( 'Table'[Week] ) )
        )
    VAR _Max =
        MAXX ( _SummaryTable, [@week] )
    RETURN
    MAXX ( FILTER ( _SummaryTable, [@week] = _Max ), [Resolved Date] )
    

     

  • Thankyou, Khashayar, Shahid12523, Kedar_Pande, and danextian for your responses.

    Hi PaulJ185,

    We appreciate your inquiry through the Microsoft Fabric Community Forum.

    We would like to inquire whether have you got the chance to check the solutions provided by Khashayar, Shahid12523, Kedar_Pande and danextian  to resolve the issue. We hope the information provided helps to clear the query. Should you have any further queries, kindly feel free to contact the Microsoft Fabric community.

    Thank you.

  • Hi PaulJ185,

    We are following up to see if what we shared solved your issue. If you need more support, please reach out to the Microsoft Fabric community.

    Thank you.