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

In Matrix table need measure only in Grand total column

In Matrix table i have used Daily Kms coloumn as coloumn for values and Totals kms as measure for values. For Total Kms i have use (Max-Min) to do my caluclation. Now i dont want to see total kms in daily dates instead want to see only in grand total.Quick help would be much appreciated.

Akhil_raj_0-1708503750225.png

 

 

9 REPLIES 9
v-xinruzhu-msft
Community Support
Community Support

Hi @Akhil_raj 

If you want to display the Total kms in grand total, you can refer to the following solution.

Sample data 

vxinruzhumsft_0-1708569206911.png

1.Create a table to put it to the column of the matrix

vxinruzhumsft_1-1708569349673.png

2.Create a measure

MEASURE =
VAR a =
    MINX (
        FILTER ( ALLSELECTED ( 'Table' ), [Name] = MAX ( 'Table'[Name] ) ),
        [Daily Km]
    )
VAR b =
    MAXX (
        FILTER ( ALLSELECTED ( 'Table' ), [Name] = MAX ( 'Table'[Name] ) ),
        [Daily Km]
    )
RETURN
    IF (
        SELECTEDVALUE ( 'Table (2)'[Column1] ) <> "Grand Total",
        CALCULATE (
            SUM ( 'Table'[Daily Km] ),
            FORMAT ( 'Table'[Date], "" ) IN VALUES ( 'Table (2)'[Column1] )
        ),
        b - a
    )

Then put the following fields to the matrix and colse the grandtotal of column

vxinruzhumsft_2-1708569417809.png

vxinruzhumsft_3-1708569453512.png

Output

vxinruzhumsft_4-1708569466261.png

 

Best Regards!

Yolo Zhu

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

 

Hi @v-xinruzhu-msft . Appreciate for your close soloution. I have a got a problem in here where in values have text for certain days(Attachment below). Using sum function is not prossible for having text and also my requriment for the calucation is to Minus max value from min value.

Akhil_raj_0-1708589224573.png

 

Hi @Akhil_raj 

You can create a new column in table 

Column = IF([Daily Km]<>"Not in use",CONVERT([Daily Km],INTEGER))

Then put the new column to the measure.

MEASURE =
VAR a =
    MINX (
        FILTER ( ALLSELECTED ( 'Table' ), [Name] = MAX ( 'Table'[Name] ) ),
        [Column]
    )
VAR b =
    MAXX (
        FILTER ( ALLSELECTED ( 'Table' ), [Name] = MAX ( 'Table'[Name] ) ),
        [Column]
    )
RETURN
    IF (
        SELECTEDVALUE ( 'Table (2)'[Column1] ) <> "Grand Total",
        CALCULATE (
            SUM ( 'Table'[Column] ),
            FORMAT ( 'Table'[Date], "" ) IN VALUES ( 'Table (2)'[Column1] )
        ),
        b - a
    )

vxinruzhumsft_0-1708590341033.png

 

Best Regards!

Yolo Zhu

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

Hi @v-xinruzhu-msft is there a way to display "Not in use" even after doing the caluclation ? dont want to leave the fields blank. Thanks for you help

Hi @Akhil_raj 

Try the following measure.

Measure = var a=MINX(FILTER(ALLSELECTED('Table'),[Name]=MAX('Table'[Name])),[Column])
var b=MAXX(FILTER(ALLSELECTED('Table'),[Name]=MAX('Table'[Name])),[Column])
var c=MAXX(FILTER('Table',FORMAT([Date],"") in VALUES('Table (2)'[Column1])),[Column])
return IF(SELECTEDVALUE('Table (2)'[Column1])<>"Grand Total",IF(NOT(ISBLANK(c)),FORMAT(CALCULATE(SUM('Table'[Column]),FORMAT('Table'[Date],"") in VALUES('Table (2)'[Column1])),""),CALCULATE(MAX('Table'[Daily Km]),FORMAT('Table'[Date],"") in VALUES('Table (2)'[Column1]))),FORMAT(b-a,""))

Output

vxinruzhumsft_0-1708591329246.png

 

Best Regards!

Yolo Zhu

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

Hi @v-xinruzhu-msft , tried everything i could with modifications, but still does the sum .please see below. 

Akhil_raj_3-1708606846577.png

 

Akhil_raj_0-1708606786912.png

Akhil_raj_1-1708606827806.png

Awaiting reply.Appreiciate 

Hi @Akhil_raj 

You need to create a new table that it contains the 'Grand Total' value. it means then the value on the matrix column is 'Grand Total' it need to  minus max value from min value.The picture you offered above doesn't contain the 'Grand Total' value.

vxinruzhumsft_0-1708651001993.png

 

Please see the attachment I have offered above

 

Best Regards!

Yolo Zhu

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

Hi @v-xinruzhu-msft 
Doesnt like to work for me . I have created exact table like you have done.Are you able to connect me on Zoom or teams please?

Hi @Akhil_raj 

Please make sure there is no relationship between your data table and fact table, it it is still not work, Can you provide some sample picture, we do not support the contract.

 

Best Regards!

Yolo Zhu

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Power BI Monthly Update - May 2024

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