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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
tvalente
Helper I
Helper I

How do I return grand total in table reference in a measure?

Hi All,

 

I am 90% of the way in a calculation but I'm stuck now... I am summarising a table based on the filter context (if someone filters date in a date slicer). All I want to do is return the grand total of rows. 

 

This is not what I want:

 

tvalente_0-1655872044047.png

 

This is what I want:

tvalente_1-1655872057175.png

 

This is my DAX so far:

 

AVG Ticket Volume =
Var MinDate = MIN(Tickets[Date_Created])
Var MaxDate = Max(Tickets[Date_Created])

VAR GrandTotal =
CALCULATE ( COUNT ( Tickets[No] ), ALLSELECTED () )

VAR CountCat =
FILTER (
ADDCOLUMNS (
SUMMARIZE ( 'Tickets', 'Tickets'[Module], 'Dates'[MonthYear] ),
"@Count",
CALCULATE (
COUNT ( Tickets[No] ),
Tickets[Date_Created] >= MinDate
&& Tickets[Date_Created] <= MaxDate
)
),
[@Count] > 0
)


RETURN CALCULATE(COUNTROWS(CountCat))

 

1 ACCEPTED SOLUTION

Hi that table is an aggregation of counts by month. So it's not a raw table. I am trying to get a average of counts by month.

 

I was able to get the numerator correct, but the denominator not. Anyway, I found a solution that has worked as below.

 

AVG Ticket Volume =

VAR AVGIT =

    CALCULATE (

        AVERAGEX (

            ADDCOLUMNS (

                SUMMARIZE ( Tickets, 'Tickets'[Module], 'Dates'[MonthYear] ),

                "@Count", CALCULATE ( COUNT ( Tickets[No] ) )

            ),

            [@Count]

        ),

        ALLSELECTED ()

    )

RETURN

    AVGIT

View solution in original post

2 REPLIES 2
NickolajJessen
Solution Sage
Solution Sage

I'm having a hard time seeing why you need such complexity in your measure:
Can you tell me why something simple like ALL(Table) wouldn't work?

NickolajJessen_0-1655879839626.png

 

Hi that table is an aggregation of counts by month. So it's not a raw table. I am trying to get a average of counts by month.

 

I was able to get the numerator correct, but the denominator not. Anyway, I found a solution that has worked as below.

 

AVG Ticket Volume =

VAR AVGIT =

    CALCULATE (

        AVERAGEX (

            ADDCOLUMNS (

                SUMMARIZE ( Tickets, 'Tickets'[Module], 'Dates'[MonthYear] ),

                "@Count", CALCULATE ( COUNT ( Tickets[No] ) )

            ),

            [@Count]

        ),

        ALLSELECTED ()

    )

RETURN

    AVGIT

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.