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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
eliasayy
Impactful Individual
Impactful Individual

Fix sum of percentage when selecting multiple date

This is my powerbi file:
https://1drv.ms/u/s!Ag9tIyk2ofNRjk0p_3vuRsnAuARs?e=TQjlu3

these are some pics:

revtable.png

week40.png

week41.png

both weeks.png

  

here's my meausre:

Percentage = 
var NEWtotalrevenue = CALCULATE(SUM(Revenue[Total]),FILTER('Calendar','Calendar'[Date] >= DATE(2022,10,3)))
VAR OLDtotalrevenue = CALCULATE(SUMX(Revenue,Revenue[Amount]*Revenue[Qtty]),FILTER('Calendar','Calendar'[Date] < DATE(2022,10,3)))
VAR totalrevenue = OLDtotalrevenue + NEWtotalrevenue
Var newsalesmanrevenue = CALCULATE(SUM(Revenue[Total]),FILTER('Calendar','Calendar'[Date] >= DATE(2022,10,3)),Revenue[Salesman]="A")
VAR Oldsalesmanrevenue = CALCULATE(SUMX(Revenue,Revenue[Amount]*Revenue[Qtty]),FILTER('Calendar','Calendar'[Date] < DATE(2022,10,3)),Revenue[Salesman]="A")
VAR salesmanrevenue = Oldsalesmanrevenue + newsalesmanrevenue
return
salesmanrevenue/totalrevenue

 

my issue is weh ni select week 40 and week 41, i want the percentage to be 1.01 not 0.51

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

Please try to create a measure like below.

 

Percentage V2 =
SUMX (
    DISTINCT ( 'Calendar'[Week of Year] ),
    DIVIDE (
        CALCULATE (
            SUM ( Revenue[Total] ),
            FILTER ( 'Calendar', 'Calendar'[Date] >= DATE ( 2022, 10, 3 ) ),
            Revenue[Salesman] = "A"
        )
            + CALCULATE (
                SUMX ( Revenue, Revenue[Amount] * Revenue[Qtty] ),
                FILTER ( 'Calendar', 'Calendar'[Date] < DATE ( 2022, 10, 3 ) ),
                Revenue[Salesman] = "A"
            ),
        CALCULATE (
            SUM ( Revenue[Total] ),
            FILTER ( 'Calendar', 'Calendar'[Date] >= DATE ( 2022, 10, 3 ) )
        )
            + CALCULATE (
                SUMX ( Revenue, Revenue[Amount] * Revenue[Qtty] ),
                FILTER ( 'Calendar', 'Calendar'[Date] < DATE ( 2022, 10, 3 ) )
            )
    )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

Please try to create a measure like below.

 

Percentage V2 =
SUMX (
    DISTINCT ( 'Calendar'[Week of Year] ),
    DIVIDE (
        CALCULATE (
            SUM ( Revenue[Total] ),
            FILTER ( 'Calendar', 'Calendar'[Date] >= DATE ( 2022, 10, 3 ) ),
            Revenue[Salesman] = "A"
        )
            + CALCULATE (
                SUMX ( Revenue, Revenue[Amount] * Revenue[Qtty] ),
                FILTER ( 'Calendar', 'Calendar'[Date] < DATE ( 2022, 10, 3 ) ),
                Revenue[Salesman] = "A"
            ),
        CALCULATE (
            SUM ( Revenue[Total] ),
            FILTER ( 'Calendar', 'Calendar'[Date] >= DATE ( 2022, 10, 3 ) )
        )
            + CALCULATE (
                SUMX ( Revenue, Revenue[Amount] * Revenue[Qtty] ),
                FILTER ( 'Calendar', 'Calendar'[Date] < DATE ( 2022, 10, 3 ) )
            )
    )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


eliasayy
Impactful Individual
Impactful Individual

thank you very much now i want to ask 
i have expense table for week 40 total is 1000
while week 41 total is 1100

i was to make when i select week 40 and week 41 together,
to make a calculations 
(percentage week 40 * expense week 40 ) + (percentage week 41 * expense week 41)

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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