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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
SH-4
Frequent Visitor

Sum the month, when only one day is selected

So I have this formula in Excel, which looks at the month number I have above my date to sum up an entire row that matches that month number in order to determine which rate I want to multiply that day's units by, since they base the rates off the monthly sum.

SH4_0-1682603740617.png=IF(SUMIF('X'!4:4, 4, 'X'!27:27)>=365000, (CS31*0.077),

IF(SUMIF('X'!4:4, 4, 'X'!27:27)>=243000, (CS31*0.095),

IF(SUMIF('X'!4:4, 4, 'X'!27:27)>=162000, (CS31*0.117),

IF(SUMIF('X'!4:4, 4, 'X'!27:27)>=121000, (CS31*0.15),

IF(SUMIF('X'!4:4, 4, 'X'!27:27)>=80000, (CS31*0.2),

IF(SUMIF('X'!4:4, 4, 'X'!27:27)>=1, (CS31*0.5),

0))))))

I'm trying to get this to work in DAX, when only one day is selected, but I can't get it to look at the whole month's numbers to sum when only one day is selected. Does anyone have any experience with trying to get this to work?

1 ACCEPTED SOLUTION
SH-4
Frequent Visitor

okay actually... I figured it out! if anyone needs it, I used a combination of TOTALMTD() and DATEMTD()

Units MTD = TOTALMTD((CALCULATE(SUM('X'[QTY]), 'X'[CLIENT_ID]="Client", 'X'[ORDTYP (groups)]="Normal")), DATESMTD('calendar'[Date]))

unit shipped revenue =
    IF([Units MTD]>=365000, ([Outbound Units X]*[unit 365k rate]),
    IF([Units MTD]>=243000, ([Outbound Units X]*[unit 243k rate]),
    IF([Units MTD]>=162000, ([Outbound Units X]*[unit 162k rate]),
    IF([Units MTD]>=121000, ([Outbound Units X]*[unit 121k rate]),
    IF([Units MTD]>=80000, ([Outbound Units X]*[unit 80k rate]),
    IF([Units MTD]>=1, ([Outbound Units X]*[unit 1 rate]),
    0))))))

View solution in original post

2 REPLIES 2
SH-4
Frequent Visitor

okay actually... I figured it out! if anyone needs it, I used a combination of TOTALMTD() and DATEMTD()

Units MTD = TOTALMTD((CALCULATE(SUM('X'[QTY]), 'X'[CLIENT_ID]="Client", 'X'[ORDTYP (groups)]="Normal")), DATESMTD('calendar'[Date]))

unit shipped revenue =
    IF([Units MTD]>=365000, ([Outbound Units X]*[unit 365k rate]),
    IF([Units MTD]>=243000, ([Outbound Units X]*[unit 243k rate]),
    IF([Units MTD]>=162000, ([Outbound Units X]*[unit 162k rate]),
    IF([Units MTD]>=121000, ([Outbound Units X]*[unit 121k rate]),
    IF([Units MTD]>=80000, ([Outbound Units X]*[unit 80k rate]),
    IF([Units MTD]>=1, ([Outbound Units X]*[unit 1 rate]),
    0))))))

Hi @SH-4 ,

 

I'm so glad you have solved your issue. And thanks for sharing this method for us to solve this issue. 

Please mark your reply as a solution. More people will benefit from it. 

 

Best Regards,
Rico Zhou

 

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.

Top Solution Authors