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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! 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
Community Champion
Community Champion

@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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.