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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Vinothsusai
Helper III
Helper III

Unable to find Total Amount based on the formula. Problem in ContainsStringExact function

Hi,

I have a problem when i sum the formula in below table. Here Formula field is refering to LineID. For ex. D3 is referring to Line ID 3. So i need to point 3rd LineItem Amount value (1952934). Like that i need to find total Amount based on the formula.

Please see the below table.

 

Line ID   GroupAccount   GroupAccountDescription   MainAccount   ReportLayout.Formula   Amount 

1R701000Gross sales70100000 1925702 
3R708001Commissions to retail partner65100000D31952934 
35R641001Chef64110001 -75.2 
36R641002Assistant64110002D3+D35+D36111478 
40R645001Chef64510001D1+D36-1698.72 
41R645002Assistant64510002 21069.99 
46R695000Subsidies64910000 62371.96 
47R621000Temporary worker62110000D40+D471920000 
48R647000Medical fees64750000D41+D47+D487595.4 
50R615001Cleaning Products60222000 499 
55R615005Maintenance contract (preventive)61560000 140157.9 
60R623003Other marketing PoS62310000D41+D47+D48+D607686.54 
62R616000Insurance61610000 13146.64 
63R622001Controls62260005D60+D621060 
68R613001Lease expense - External party61320001 35624.28 
136R623530Agency Compensation62300000D68+D13688372.66 
137R623540Catalogues / Brochures62360000 180617.9 
139R628500Others62310000D137+D1397686.54 
142R622620Audit fees62260003 2700 
155R622820Official Acts62270001 23195.7 

 

 i have a problem in ContainsStringExact function in formula. It doesnt match exact lineItemID. Could you please advise.

Measure Formula = VAR maxf =
MAX ( HANGeneralJournals_Remodify[ReportLayout.Formula])

RETURN
IF ( maxf = BLANK () ,SUM(HANGeneralJournals_Remodify[Custom Main Amount]), CALCULATE(SUM(HANGeneralJournals_Remodify[Custom Main Amount]),FILTER(ALL(HANGeneralJournals_Remodify),ISBLANK([ReportLayout.Line ID])=FALSE()&&CONTAINSSTRINGEXACT(maxf,"D"&[ReportLayout.Line ID]))))
 
Thanks
Vinoht SUSAINATHAN
2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

I read this through a couple times but wasn't able to make out what you are going for here. Can you provide an example of the expected output?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hi,

Thank you for your reply.

I am expecting the output like below. Please help me

32.png

Data

LineIDAmountFormulaTotal Amount
1100 100 
250D1+D2150 
3200D1+D3300 
470D2+D4120 
520D1+D2+D4220 
610D4+D680 
720D5+D6+D750 
10110D5+D6+D750 
11130D10+D11240 

Please advise.

 

Thanks

Vinoht S

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.