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
proavinash
Helper I
Helper I

How to use SUMIFS in power BI ( Customer wise MTD sale) when Customer code one table and Sale Dump

How to use SUMIFS in power BI ( Customer wise MTD sale) when Customer code one table and Sale Dump other table.

 

Sale dump table

Customer code    Customer Name        date                    Region      zone      Qty       Sale Net

1000001                   Ramesh                 10-10-2018         North       NCR       30         183642

2

3

4

and so on

 

Customer Table

 

Customer Code      MTD Sale      QTD Sale     YTD Sale     Q1 Sale     Q2 Sale    Q3 Sale     Q4 Sale

1000001

2

3

4

and so on

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @proavinash 

Thanks for the reply from Kedar_Pande, ThxAlot and lbendlin. You can use the dax to achieve your need. By the way, note that there seems to be a problem with the MTD and QTD you posted for 1002 and 1003, the data in the following screenshot seems to be the correct result.

vyaningymsft_0-1735201234887.png
Measure: 

SaleMTD = 
VAR _todayYear =
    YEAR ( TODAY () )
VAR _todayQuarter =
    QUARTER ( TODAY () )
VAR _todayMonth =
    MONTH ( TODAY () )
VAR _date =
    SELECTEDVALUE ( Demand[Date] )
VAR _re =
    IF (
        YEAR ( _date ) = _todayYear
            && MONTH ( _date ) = _todayMonth
            && _date <= TODAY (),
        SUM ( Demand[Net Sale] ),
        0
    )
RETURN
    _re


SaleQTD = 
VAR _todayYear =
    YEAR ( TODAY () )
VAR _todayQuarter =
    QUARTER ( TODAY () )
VAR _todayMonth =
    MONTH ( TODAY () )
VAR _date =
    SELECTEDVALUE ( Demand[Date] )
VAR _re =
    IF (
        YEAR ( _date ) = _todayYear
            && QUARTER ( _date ) = _todayQuarter
            && _date <= TODAY (),
        SUM ( Demand[Net Sale] ),
        0
    )
RETURN
    _re


SaleYTD = 
VAR _todayYear =
    YEAR ( TODAY () )
VAR _todayQuarter =
    QUARTER ( TODAY () )
VAR _todayMonth =
    MONTH ( TODAY () )
VAR _date =
    SELECTEDVALUE ( Demand[Date] )
VAR _re =
    IF ( YEAR ( _date ) = _todayYear, SUM ( Demand[Net Sale] ), 0 )
RETURN
    _re

 

Best Regards,
Yang

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know.
Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

6 REPLIES 6
Kedar_Pande
Super User
Super User

@proavinash 

Ensure there is a relationship between the Customer Table[Customer Code] and Sale Dump Table[Customer code].

MTD Sale = 
CALCULATE(
SUM('Sale Dump Table'[Sale Net]),
DATESMTD('Sale Dump Table'[date])
)

💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn

ThxAlot
Super User
Super User

Quite some shxty rookies, like this one, order other around and take for granted that any others are supposed to help.



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



proavinash
Helper I
Helper I

NEED RESULT LIKE CUSTOMER TABLE.

Anonymous
Not applicable

Hi, @proavinash 

Thanks for the reply from Kedar_Pande, ThxAlot and lbendlin. You can use the dax to achieve your need. By the way, note that there seems to be a problem with the MTD and QTD you posted for 1002 and 1003, the data in the following screenshot seems to be the correct result.

vyaningymsft_0-1735201234887.png
Measure: 

SaleMTD = 
VAR _todayYear =
    YEAR ( TODAY () )
VAR _todayQuarter =
    QUARTER ( TODAY () )
VAR _todayMonth =
    MONTH ( TODAY () )
VAR _date =
    SELECTEDVALUE ( Demand[Date] )
VAR _re =
    IF (
        YEAR ( _date ) = _todayYear
            && MONTH ( _date ) = _todayMonth
            && _date <= TODAY (),
        SUM ( Demand[Net Sale] ),
        0
    )
RETURN
    _re


SaleQTD = 
VAR _todayYear =
    YEAR ( TODAY () )
VAR _todayQuarter =
    QUARTER ( TODAY () )
VAR _todayMonth =
    MONTH ( TODAY () )
VAR _date =
    SELECTEDVALUE ( Demand[Date] )
VAR _re =
    IF (
        YEAR ( _date ) = _todayYear
            && QUARTER ( _date ) = _todayQuarter
            && _date <= TODAY (),
        SUM ( Demand[Net Sale] ),
        0
    )
RETURN
    _re


SaleYTD = 
VAR _todayYear =
    YEAR ( TODAY () )
VAR _todayQuarter =
    QUARTER ( TODAY () )
VAR _todayMonth =
    MONTH ( TODAY () )
VAR _date =
    SELECTEDVALUE ( Demand[Date] )
VAR _re =
    IF ( YEAR ( _date ) = _todayYear, SUM ( Demand[Net Sale] ), 0 )
RETURN
    _re

 

Best Regards,
Yang

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know.
Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

lbendlin
Super User
Super User

Please provide sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.

NEED RESULT CUSTOMER WISE MTD SALE , QTD SALE, YTD SALE, THEN Q1, Q2 , Q3, Q4, LIKE DISPLAY IN CUSTOMER TABLE.

 

DATABASE TABLE.

Customer CodeCustomer NameDateRegionZoneQtyNet Sale
10000001Ramesh10-10-2018NorthNCR50454645
10000002Ram10-11-2024EastTN45343645
10000003Shayam12-19-2024WestUP East64132323
10000004Kumar Bisvas10-13-2018SouthAP354545464
10000005Raju10-14-2018NorthWB672343432
10000006Ram Gopal10-15-2018EastKTK458735454
10000007Kamal10-16-2018WestRAJ759834738
10000008Neel Nitin10-17-2018SouthGUJ76763476
10000009Suraj10-18-2018NorthMUM54334455
10000010Jyoti10-19-2018EastNCR45243545
10000006Ram Gopal10-15-2018EastKTK458735454
10000007Kamal10-16-2018WestRAJ759834738
10000008Neel Nitin10-17-2018SouthGUJ76763476
10000009Suraj10-18-2018NorthMUM54334455
10000010Jyoti10-19-2018EastNCR45243545
10000001Ramesh10-10-2018NorthNCR50454645
10000002Ram10-11-2024EastTN45343645
10000003Shayam12-19-2024WestUP East64132323
10000004Kumar Bisvas10-13-2018SouthAP354545464
10000005Raju10-14-2018NorthWB672343432
10000006Ram Gopal10-15-2018EastKTK458735454
10000007Kamal10-16-2018WestRAJ759834738
10000008Neel Nitin10-17-2018SouthGUJ76763476
10000009Suraj10-18-2018NorthMUM54334455
10000010Jyoti10-19-2018EastNCR45

243545

 

 

RESULT

 

Customer CodeMTD SALEQTD SALEYTD SALE
10000001000
100000022646460264646
100000030687290687290
10000004000
10000005000
10000006000
10000007000
10000008000
10000009000
10000010000

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.