Forum Discussion

aditi11's avatar
aditi11
Frequent Visitor
3 years ago
Solved

Sales based on user selection

Hello community, I want to calculate total sales based on user selection. If user selects any no. From 1 to 30 in slicer, then he should be able to see total sales for that day in visual (column chart). I have created parameters for the same. But it is not working. Please help.

Thanks 

Power BI Report Server automatic sign in 

 

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi aditi11 ,

    I have created a simple sample, please refer to it to see if it helps you.

    Create a calendar date.

    Table = CALENDAR(DATE(2022,10,1),DATE(2022,10,31))

    Then create a measure.

    Measure =
    VAR _1sum =
        CALCULATE (
            SUM ( Sheet1[value] ),
            FILTER ( ALL ( Sheet1 ), Sheet1[date] <= MAX ( 'Table'[Date] ) )
        )
    VAR _2 =
        CALCULATE (
            MAX ( Sheet1[value] ),
            FILTER ( ALL ( Sheet1 ), Sheet1[date] = TODAY () )
        )
    RETURN
        IF ( SELECTEDVALUE ( 'Table'[Date] ) = BLANK (), _2, _1sum )
    

    If I have misunderstood your meaning, please  provide your pbix file without privacy information and desired output with more details.

     

    Best Regards

    Community Support Team _ Polly

     

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

     

     

2 Replies

  • aditi11's avatar
    aditi11
    Frequent Visitor

    Hello community, I want to calculate total sales based on user selection. If user selects any no. From 1 to 30 in slicer, then he should be able to see total sales for that day in visual (column chart). I have created parameters for the same. But it is not working. Please help.

    amitchandak 

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi aditi11 ,

    I have created a simple sample, please refer to it to see if it helps you.

    Create a calendar date.

    Table = CALENDAR(DATE(2022,10,1),DATE(2022,10,31))

    Then create a measure.

    Measure =
    VAR _1sum =
        CALCULATE (
            SUM ( Sheet1[value] ),
            FILTER ( ALL ( Sheet1 ), Sheet1[date] <= MAX ( 'Table'[Date] ) )
        )
    VAR _2 =
        CALCULATE (
            MAX ( Sheet1[value] ),
            FILTER ( ALL ( Sheet1 ), Sheet1[date] = TODAY () )
        )
    RETURN
        IF ( SELECTEDVALUE ( 'Table'[Date] ) = BLANK (), _2, _1sum )
    

    If I have misunderstood your meaning, please  provide your pbix file without privacy information and desired output with more details.

     

    Best Regards

    Community Support Team _ Polly

     

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