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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
aditi11
Frequent Visitor

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 

 

1 ACCEPTED SOLUTION
v-rongtiep-msft
Community Support
Community Support

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 )

vpollymsft_0-1665971539746.png

vpollymsft_1-1665971552573.png

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.

 

 

View solution in original post

2 REPLIES 2
v-rongtiep-msft
Community Support
Community Support

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 )

vpollymsft_0-1665971539746.png

vpollymsft_1-1665971552573.png

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.

 

 

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 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.