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
jpfeif1
New Member

Question on how to sumif when creating a variable

 

I have the following Dax formula. 

Y2023 = rounddown(CALCULATE(sum(EROSION[Value]), EROSION[DATA TYPE] in {"FUNNEL","Baseline","Forecast"},EROSION[Year]="Y2023")/1000000,1)
 
I would the ability to change this so only the "Baseline" erosion type will be /2000000,1  and Funnel and Forecast be remain /1000000,1
Any ideas would be appreciated.
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @jpfeif1 

You can try the following code:

 

Y2023 = switch(true(),EROSION[DATA TYPE] in {"FUNNEL","Forecast"},rounddown(CALCULATE(sum(EROSION[Value]),EROSION[Year]="Y2023")/1000000,1),EROSION[DATA TYPE] in {"Baseline"},rounddown(CALCULATE(sum(EROSION[Value]),EROSION[Year]="Y2023")/2000000,1))

 

Best Regards!

Yolo Zhu

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
Anonymous
Not applicable

Hi @jpfeif1 

You can try the following code:

 

Y2023 = switch(true(),EROSION[DATA TYPE] in {"FUNNEL","Forecast"},rounddown(CALCULATE(sum(EROSION[Value]),EROSION[Year]="Y2023")/1000000,1),EROSION[DATA TYPE] in {"Baseline"},rounddown(CALCULATE(sum(EROSION[Value]),EROSION[Year]="Y2023")/2000000,1))

 

Best Regards!

Yolo Zhu

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

 

FreemanZ
Super User
Super User

try like:
Y2023 =
rounddown(
    CALCULATE(
         sum(EROSION[Value]),
         EROSION[DATA TYPE] in {"FUNNEL","Forecast"},
         EROSION[Year]="Y2023"
     )/1000000,
    1
)
+
rounddown(
         CALCULATE(
                  sum(EROSION[Value]), 
                  EROSION[DATA TYPE] ="Baseline",
                  EROSION[Year]="Y2023"
          )/2000000,
        1
)
 
or
 
Y2023 =
ROUNDDOWN(
SUMX(
    FILTER(
       EROSION,
       EROSION[Year]="Y2023"
         &&EROSION[DATA TYPE] in {"FUNNEL","Baseline","Forecast"},
    ),
    IF(
       EROSION[DATA TYPE] ="Baseline",
       EROSION[Value]/2000000,
       EROSION[Value]/1000000
    )
),1)
 
in case of issue, please share some sample data.

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.