Forum Discussion

JD09's avatar
JD09
Advocate I
2 years ago
Solved

Overall Total Mismatch in Table Visual

Hello,
Need help in solving the below problem definition:

A Power BI Measure needs to Fetch The Latest Product Quantity for the Selected Date & Product (Currently Measure Fetches the Latest Product Qty based On Date & Product Selection.)
Now the issue is when you Place this measure in the Table Visual, There is a Missmatch in Overall Total Quantity.

DAX Used for the Measure

 

Measure =
Var getminDate = MIN(Sheet1[Date])
Var getMaxDate = MAX(Sheet1[Date])
Return
IF(
    getminDate = getMaxDate,
    CALCULATE(
        SUM(Sheet1[Qunatity]),
        Sheet1[Date] = getminDate
    ),
    CALCULATE(
        SUM(Sheet1[Qunatity]),
        Sheet1[Date]=getMaxDate
    )
)


Please find the reference Screenshot.

 


Thank you in Advance!

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi JD09 

    You can create  a new measure.

     

    Total =
    SUMX ( VALUES ( 'Table'[Product Name] ), [Measure] )

     

     the [product name] field need to make sure is the field that you put to the table visual.

     

    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.

     

     

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi JD09 

    You can create  a new measure.

     

    Total =
    SUMX ( VALUES ( 'Table'[Product Name] ), [Measure] )

     

     the [product name] field need to make sure is the field that you put to the table visual.

     

    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.

     

     

  • Nithinr's avatar
    Nithinr
    Resolver III

    To solve this you need to create a non related calender table and use it as a slicer

    calendar = CALENDAR(DATE(2024,1,1),DATE(2024,12,31))

     

    just tweak the existing measure to use calendar date

     

    Measure =
    Var getminDate = MIN(calendar[Date])
    Var getMaxDate = MAX(calendar[Date])
    Return
    IF(
        getminDate = getMaxDate,
        CALCULATE(
            SUM(Sheet1[Qunatity]),
            Sheet1[Date] = getminDate
        ),
        CALCULATE(
            SUM(Sheet1[Qunatity]),
            Sheet1[Date]=getMaxDate
        )
    )