Forum Discussion

dpombal's avatar
dpombal
Icon for Post Partisan rankPost Partisan
2 years ago
Solved

Get the maximum sum of sales for all dates

Hi all ,I am facing problems with a quite basic Dax formula, in fact looks like a bug ( I am using Power bi desktop Version: 2.129.1229.0 64-bit (May 2024)).   Download sample PBIX link https://1dr...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi,dpombal 

    Regarding the issue you raised, my solution is as follows:

    The reason why the maximum value is not 300 is because of the influence of the slicer "session type". When you select the two dates, the slicer "session type" also follows the time slicer and filters only the value whose session type is night, as shown in the figure below. Thus the maximum value is returned to 290.

    I offer you two solutions:

    1.The first method, to manage the relationship between visual objects, disconnects the relationship between the date slicer and the two maximum visual objects, as shown below:

    The following documents are relevant to help you:

    Change how visuals interact in a report - Power BI | Microsoft Learn

     

    2.The second method:

    Create a new table with a date column to ensure that the date slicer does not affect the "session type" of the slicer:

    Table = SELECTCOLUMNS('SalesT',"Date",'SalesT'[Date])

    Use the date column of the new table as the new slicer:

    Here are the measure for replacing the bar chart visual object:

    Measure = 
    VAR cc=VALUES('Table'[Date])
    RETURN CALCULATE(SUM(SalesT[SalesAmount]),FILTER(SalesT,'SalesT'[Date] IN cc))
    

     

    3.Here are the final results:

     

    Please find the attached pbix relevant to the case.

    Method 1 is in Page 1, Method 2 is in page2

     

    Best Regards,

    Leroy Lu

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