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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Cumulative YTD with Multiple Criteria

Hi Power BI folks

 

Looking for some help with the DAX measure named YTD that will be used for table visualization. YTD must show a cumulative sum based on purchase volume to customers. I partially created the DAX which needs some further tweaking.

 

Cumulative YTD Actual Volume = calculate (SUM(Actual[SALESQYT]*10), DATESYTD('Date'[Date])), but I need to include one more criteria in this DAX measure i.e. for customer A and C the Sales Volume to be multiplied by 20. Sample of the desired data is shown the following table.

DATASETS

Customer QuantityDateMon_Num
A8610/01/20201
B6401/01/20201
D6123/02/20192
A5114/02/20192
A6105/02/20192
D6626/03/20193
B9117/01/20191
B6408/01/20191
C6330/04/20204
C9421/04/20204
D7412/04/20204
C4303/04/20204
A7324/03/20203
B4315/01/20201

FINAL OUTPUTS

CustomerSum of QuantityCriteria for DAX
A5420multiplied by 20
B2620 
C4000multiplied by 20
D2010 

 

Can anyone help me in completing the DAX the measure to get the below-desired outputs

 

As shown in the sample data set and the final output.

5 REPLIES 5
Anonymous
Not applicable

Please find a file attached. I have set up a model that can accommodate any multiplication factors for each and every customer.

 

Best

D

nandukrishnavs
Super User
Super User

@Anonymous 

 

Cumulative YTD Actual Volume = 
CALCULATE (
    SUMX (
        MyTable,
        IF (
            MyTable[Customer ]
                IN {
                "A",
                "C"
            },
            MyTable[Quantity] * 20,
            MyTable[Quantity] * 10
        )
    ),
    FILTER (
        ALL ( 'MyTable'[Date].[Date] ),
        'MyTable'[Date].[Date]
            <= MAX ( 'MyTable'[Date].[Date] )
    )
)
//If you are not using the Date Hierarchy then you can remove .[Date] from the above part ('MyTable'[Date].[Date])

out.JPG



Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂


Regards,
Nandu Krishna

Anonymous
Not applicable

Thanks @nandukrishnavs for your inputs. I managed to get the solution fixed, sorry for nicking your DAX a bit and merged with my earlier measure it is perfectly working now. The final DAX measure - 

 

**bleep** YTD Act Vol =
CALCULATE (
SUMX (
Customer,
IF (
Customer[CLIENT]
IN { "A",  "C" },
[Act Vol] * 20,
[Act Vol] * 10
)
),
DATESYTD('Date'[Date]
)
)
 
thanks for reaching out to me.
harshnathani
Community Champion
Community Champion

Hi @Anonymous ,

 

You can try these measures. Not sure why YTD.

 

Sum of Quantity = SUM(Table9[Quantity])

 

Multiplied Factor = IF(SELECTEDVALUE(Table9[Customer ]) IN ({"A","C"}) , [Sum of Quantity] * 20 , [Sum of Quantity]*10)
 
1.jpg
 
Regards,
Harsh Nathani
 
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!!
Anonymous
Not applicable

Thanks @harshnathani  for your contribution - The DAX measure output was to calculate Cumulative Sum.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.