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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
elpulley
Frequent Visitor

Grand Total of measure doesn't equal sum of row values

I have daily data and am trying to calculate minimum values over a certain time period. The value for each row is correct and shows the minimum value for that floor over the time period. The Grand Total value of 232 is not the sum of the minimums (213), but is the minimum single day total over the time period. 

 

 Minimum v2.PNG

The measure code is: Office Worker Swipes - Min = MINX(DateTable,DailySwipes[Office Worker Swipes (C)]) where Date Table is my mapping table for each day and Office Worker Swipes (C) is a measure calculating the value for each floor each day. Can someone help me with my syntax so that the values in the rows stay the same but the grand total calculates the sum of the rows?

1 ACCEPTED SOLUTION
Vvelarde
Community Champion
Community Champion

@elpulley

 

Hi, use this as guide to obtain your total, Specially the bold part

 

MinOW =
IF (
    HASONEVALUE ( Table1[Floor] ),
    MINX ( DateTable; MIN ( Table1[Office Workers Swipe] ) ),
    SUMX (
        SUMMARIZE (
            Table1;
            Table1[Floor],
            "MINVALUE"; MIN ( Table1[Office Workers Swipe] )
        );
        [MINVALUE]
    )
)



Lima - Peru

View solution in original post

6 REPLIES 6
kliberty
Frequent Visitor

Vvelarde
Community Champion
Community Champion

@elpulley

 

Hi, use this as guide to obtain your total, Specially the bold part

 

MinOW =
IF (
    HASONEVALUE ( Table1[Floor] ),
    MINX ( DateTable; MIN ( Table1[Office Workers Swipe] ) ),
    SUMX (
        SUMMARIZE (
            Table1;
            Table1[Floor],
            "MINVALUE"; MIN ( Table1[Office Workers Swipe] )
        );
        [MINVALUE]
    )
)



Lima - Peru

Can you help me understand what this formula is doing? I am getting a huge value. Also, my Office Workers Swipe (C) column is a measure, so I cannot use it in a MIN function.

@elpulley

 

Can you share me some sample data and the formula of your measure.

 

Thanks




Lima - Peru

I am not sure what your formula is doing, but I was able to make it work. I had to create a Custom Column in the query editor to make the Office Workers Swipes a column in the data rather than a measure summing two columns. This allowed me to use it in the MIN function in the forumla above. The picture below shows a week of sample data swipes, my old min column with an incorrect Grand Total, and your new min column with the correct grand total:

 

Fixed Min Function.PNG

 

My measure code is below: 

MinOW = IF(
			HASONEVALUE(LocationMaster[Floor]),
			MINX('Date Table',MIN(DailySwipes[Office Worker Swipes])),
			SUMX(
				SUMMARIZE(
					LocationMaster,
					LocationMaster[Floor],
					"MINVALUE",MIN(DailySwipes[Office Worker Swipes])
				),
			[MINVALUE]
			)

Thanks for your help!

 

@elpulley

 

The Formula works in this way:

 

MinOW = 
//First evaluate if is in Floor Rows or is in the Total (When HASONEVALUE is False is the total)

IF( HASONEVALUE(LocationMaster[Floor]),

//if is true obtain the MINX of your Office Worker Swipes MINX('Date Table',MIN(DailySwipes[Office Worker Swipes])),

//if is false create a summarize table when the floor and his respective MINX Office Worker Swipes and
after that aaplied a SUM of all the MINVALUEs. SUMX( SUMMARIZE( LocationMaster, LocationMaster[Floor], "MINVALUE",MIN(DailySwipes[Office Worker Swipes]) ), [MINVALUE] )



Lima - Peru

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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