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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
esuryahadi
Helper I
Helper I

Dax formula results do not match

Hello,
I have difficulty. I created a DAX formula like this.

Screenshot 2024-01-16 155156.png

 

However, the results are not appropriate.
it should be that on 1 Feb 2024 the column "SisaNilaiKontrak"after deducting the value on 1 Jan 2024 should be worth 279.64.
($424.64 - $145)

what should I change to the formula?

 

Thank you

https://drive.google.com/file/d/1oXdO-1hdSNzbpNH4brRZTkRyeSxxJ5zj/view?usp=sharing

1 ACCEPTED SOLUTION
v-tangjie-msft
Community Support
Community Support

Hi @esuryahadi ,

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) Click "transform data" to enter the power query and add a index column.

(3) We can createa measure and calculated columns.

Column = 
 CALCULATE(SUM('Contract'[Remaining Contract Value (USD)]),FILTER('SPK Plan',[No. Contract]=EARLIER('SPK Plan'[No. Contract])))-[Spk Plan ]
Measure = CALCULATE(MAX('SPK Plan'[Column]),FILTER(ALL('SPK Plan'),[Index]=1))
Column 2 = var _a=CALCULATE(SUM('SPK Plan'[Spk Plan ]),FILTER('SPK Plan','SPK Plan'[Index]<=EARLIER('SPK Plan'[Index])-1))
return  [Measure]-_a

(3) Then the result is as follows.

vtangjiemsft_0-1705889665647.png

 

If the above one can't help you get the desired result, please provide your expected result with backend logic and special examples. Thank you.

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

View solution in original post

4 REPLIES 4
v-tangjie-msft
Community Support
Community Support

Hi @esuryahadi ,

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) Click "transform data" to enter the power query and add a index column.

(3) We can createa measure and calculated columns.

Column = 
 CALCULATE(SUM('Contract'[Remaining Contract Value (USD)]),FILTER('SPK Plan',[No. Contract]=EARLIER('SPK Plan'[No. Contract])))-[Spk Plan ]
Measure = CALCULATE(MAX('SPK Plan'[Column]),FILTER(ALL('SPK Plan'),[Index]=1))
Column 2 = var _a=CALCULATE(SUM('SPK Plan'[Spk Plan ]),FILTER('SPK Plan','SPK Plan'[Index]<=EARLIER('SPK Plan'[Index])-1))
return  [Measure]-_a

(3) Then the result is as follows.

vtangjiemsft_0-1705889665647.png

 

If the above one can't help you get the desired result, please provide your expected result with backend logic and special examples. Thank you.

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

ryan_mayu
Super User
Super User

what's the calculation logic?

pls provide the sample data (not the screenshot) and the expected output





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Ritaf1983
Super User
Super User

Hi @esuryahadi 
Try to create a measure instead of a calculated column.
If it doesn't help

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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