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
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
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.