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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
thatjoey20
Helper II
Helper II

Insert different values in a column based on different conditions

Hello guys, 


I am struggling trying to define this DAX statement, 

basically I have a table where there are ID_SELLER, NAME SELLER, MONTH NUM and I want to insert GOAL VALUE differently through the months for each seller 

So for instance if ID_SELLER == 300 && MONTH NUM == 1, GOAL VALUE = 120000
                                                    ''           MONTH  NUM == 2, GOAL VALUE = 130000
                                                    later on
                                                    301       MONTH NUM  == 1....           VALUE = 50000
                                                                                                2

I tried using SWITCH(IF(ID_SELLER == 300 && MONTH NUM == 1, TRUE()), TRUE(), 120000) 


but didn't know how to continue inserting other months since DAX doesnt let me set values in variable conditions. I believe this would result in a many lines statement, does anyone have a simillar solution or can help with something? 

Thank you very much

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@thatjoey20 , Create a new column like

 

GOAL VALUE = Switch( True(),
[ID_SELLER] = 300 && [MONTH NUM] = 1, 120000,
[ID_SELLER] = 300 && [MONTH NUM] = 2,130000
//add others
)

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

View solution in original post

3 REPLIES 3
Nathaniel_C
Community Champion
Community Champion

Hi @thatjoey20 ,
Try this measure

GOAL TO REACH =
IF (
    Goals[Seller ID] = 300
        && Goals[Month #] = 1,
    12000,
    IF (
        Goals[Seller ID] = 300
            && Goals[Month #] = 2,
        13000,
        IF ( Goals[Seller ID] = 301 && Goals[Month #] = 1, 50000 )
    )
)

 

seller.PNG


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




amitchandak
Super User
Super User

@thatjoey20 , Create a new column like

 

GOAL VALUE = Switch( True(),
[ID_SELLER] = 300 && [MONTH NUM] = 1, 120000,
[ID_SELLER] = 300 && [MONTH NUM] = 2,130000
//add others
)

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

It worked!! Thank you very much! Just needed to put true as a expression condition ! 

Helpful resources

Announcements
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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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