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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

value subtraction in single column between two dates

I have table name called  Master data base . in this table have column name value  like below 

 

Reductionbucket                             Months                        Value     

OustockConsumation                    Ac Jan                            0.05

 Scrap                                             Ac Jan                           0.08   

 Supply Improvemtns                    Ac Jan                            0.28        

 New Materials                              Ac Jan                            0.55

SellBack OME"S                             Ac Jan                            0.55

OustockConsumation                    Ac Feb                           0.45

 Scrap                                             Ac Feb                           0.38   

 Supply Improvemtns                    Ac Feb                            0.18        

 New Materials                              Ac Feb                            0.75

SellBack OME"S                             Ac Feb                           0.55

.

.

.

.

OustockConsumation                      Jan                            0.35

 Scrap                                               Jan                           0.28   

 Supply Improvemtns                       Jan                           0.48        

 New Materials                                Jan                            0.15

SellBack OME"S                               Jan                            0.85

 

 

i want to calculation like for  Example Jan 

 

=(ACJan*-1) - (Jan*-1)

 

 also i want to get total variation of the value . i have created sperat table like below 

THENNA_41_0-1645496457163.png

 

Here i have created measure 

 

Total Month Variation =

IF(SELECTEDVALUE('Order Table'[Sno])="6.Total FY Variation",
CALCULATE(SUM('Master Data Base'[Value]) ,ALLSELECTED('Order Table'[Sno])),

SUM('Master Data Base'[Value]))
 
But i am  wrong getting correct value . looking for support . thanks in advance 

 

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

Hi @Anonymous ,

According to your description, if you mean when select  "6.Total FY Variation" in the slicer, it should calculate the sum of all Value in the 'Master Data Base' table, you should replace ALLSELECTED in the formula with ALL, as ALLSELECTED only contain the selected value in the slicer, but ALL return all values ignore the slicer.

Reference: ALLSELECTED function (DAX) - DAX | Microsoft Docs

ALL function (DAX) - DAX | Microsoft Docs

Total Month Variation = 
IF (
    SELECTEDVALUE ( 'Order Table'[Sno] ) = "6.Total FY Variation",
    CALCULATE (
        SUM ( 'Master Data Base'[Value] ),
        ALL ( 'Order Table'[Sno] )
    ),
    SUM ( 'Master Data Base'[Value] )
)

It works fine in my sample.

 

vkalyjmsft_0-1645773683862.pngvkalyjmsft_1-1645773698410.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

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

2 REPLIES 2
v-yanjiang-msft
Community Support
Community Support

Hi @Anonymous ,

According to your description, if you mean when select  "6.Total FY Variation" in the slicer, it should calculate the sum of all Value in the 'Master Data Base' table, you should replace ALLSELECTED in the formula with ALL, as ALLSELECTED only contain the selected value in the slicer, but ALL return all values ignore the slicer.

Reference: ALLSELECTED function (DAX) - DAX | Microsoft Docs

ALL function (DAX) - DAX | Microsoft Docs

Total Month Variation = 
IF (
    SELECTEDVALUE ( 'Order Table'[Sno] ) = "6.Total FY Variation",
    CALCULATE (
        SUM ( 'Master Data Base'[Value] ),
        ALL ( 'Order Table'[Sno] )
    ),
    SUM ( 'Master Data Base'[Value] )
)

It works fine in my sample.

 

vkalyjmsft_0-1645773683862.pngvkalyjmsft_1-1645773698410.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

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

 

amitchandak
Super User
Super User

@Anonymous , Your calculations are not clear to me. Please explain by using an example

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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