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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
ashmitp869
Post Partisan
Post Partisan

dax expression not working - Purchase Order Value

Hi,

Can someone please suggest 

Data model 

Projects (project_id) = Contract(Project_id) one to many

Contract(contract_id)= Contract_LineItem(contract_id) one to many both
Contract(contract_id)= ContractCustomField(one to one) both

ashmitp869_0-1741056948491.png

 

PurchaseOrderValue = 
CALCULATE(
    SUM(ContractCustomField[PurchaseOrderValue]),
    ContractCustomField[IsActive] = TRUE()
   
)

 Not sure with this relationship
Contract(contract_id)= Contract_LineItem(contract_id) one to many both

When WBS is selected the Purchase Order Value is correct which the above related.

But the

whole total Purchase Order Value is Total is not correct.

Please suggest.

1 ACCEPTED SOLUTION

Hi,

I do not know why that is happening but the figure in the visual seems correct.  In the Table view, i filtered the ContractCustomField table on TRUE (ISACTIVE) and 1 (ProjectID).  When i export that table to Excel, i get the same answer as shown in the visual.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

8 REPLIES 8
v-ssriganesh
Community Support
Community Support

Hi @ashmitp869,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.

v-ssriganesh
Community Support
Community Support

Hi @ashmitp869,

May I ask if you have resolved this issue? If so, please mark it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

v-ssriganesh
Community Support
Community Support

Hi @ashmitp869,

Thank you for posting your query in the Microsoft Fabric Community Forum, and thanks to @Ashish_Mathur & @bhanu_gautam for sharing valuable insights.

 

Could you please confirm if your query has been resolved by the provided solution? If so, please mark it as the solution. This will help other community members solve similar problems faster.

Thank you.

Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file.  Show the problem there clearly.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur 
sharing the sample file.
https://github.com/suvechha/samplepbi/blob/main/sample_info%20-%20po.pbix


Problem -
When export to excel and check the Sum is giving 3569728.95

ashmitp869_1-1741059948839.png

 

While report -

ashmitp869_2-1741059985067.png

 

Hi,

I do not know why that is happening but the figure in the visual seems correct.  In the Table view, i filtered the ContractCustomField table on TRUE (ISACTIVE) and 1 (ProjectID).  When i export that table to Excel, i get the same answer as shown in the visual.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi ,

 

I found the reason -which I am having duplicate
Contract(contract_id)= Contract_LineItem(contract_id) one to many both

Contract 500011 is having three Line items in table Contract_LineItem with WBS Code 1131.

ashmitp869_0-1741078631048.png

I only require one line

i.e 

ashmitp869_1-1741078815605.png

But when the TOTAL is calculating its having three lines - and thus the TOTAL is different i.e 4,377,206.28.

while export to excel its giving the correct result. But the visual is showing wrong.
Any suggestion, how to handle this

bhanu_gautam
Super User
Super User

@ashmitp869 Try using

DAX
PurchaseOrderValue =
CALCULATE(
SUM(ContractCustomField[PurchaseOrderValue]),
ContractCustomField[IsActive] = TRUE(),
ALL(ContractCustomField)
)

 

You can use variables to debug and understand the intermediate values in your DAX

DAX
PurchaseOrderValue =
VAR ActiveContracts =
FILTER(
ContractCustomField,
ContractCustomField[IsActive] = TRUE()
)
RETURN
CALCULATE(
SUM(ContractCustomField[PurchaseOrderValue]),
ActiveContracts
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Solution Authors