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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
THENNA_41
Post Partisan
Post Partisan

Condition is not working

Data Sampple:

Local FPV'[prod Cat] Local FPV'[Markets]  Local FPV'[Cigarettes Per Pack (Product Information)] Local FPV'[Cigarettes Per Outer (*)]
0                           CA04                                                       180                                                                  180
0                          CA04                                                        18                                                                    180
0                          CA04                                                       180                                                                   180
0                           TW04                                                      122                                                                   50
1                          DE04                                                       50                                                                      88


already measures are created based on the condition

Local FPV'[prod Cat]= 0 then [#Gross_FPV]

Local FPV'[prod Cat]= 1 then [#Gross_otp]


Current Dax

#G =
Var selval=SELECTEDVALUE('Local FPV'[prod Cat],"Nothing Selected")
RETURN
ROUND(IF(selval=0,[#Gross_FPV],IF(selval=1,[#Gross_otp],BLANK())),3)

 

Now i want add new calculation if below condtion match then [#Gross_180_cal]


Local FPV'[prod Cat] Local FPV'[Markets] Local FPV'[Cigarettes Per Pack (Product Information)] Local FPV'[Cigarettes Per Outer (*)]
0                                            CA04                                              180                                                           180

IF( Local FPV'[prod Cat] =0 && Local FPV'[Cigarettes Per Pack (Product Information)]=180 && Local FPV'[Cigarettes Per Outer (*)=180]


#Gross_FPV_180

IF( Local FPV'[prod Cat] =0 && Local FPV'[Cigarettes Per Pack (Product Information)]<>180 && Local FPV'[Cigarettes Per Outer (*)<>180]

[#Gross_FPV]

IF Local FPV'[prod Cat]= 1 then [#Gross_otp]


created DAX but  [#Gross_FPV_180],  this condition code not working 

 

Var selval = SELECTEDVALUE('Local FPV'[prod Cat], "Nothing Selected")
Var market = SELECTEDVALUE('Local FPV'[Markets], "Unknown Market")
Var cigpack=SELECTEDVALUE('Local FPV'[Cigarettes Per Pack (Product Information)],"Nothing selectd")
var cigouter=SELECTEDVALUE('Local FPV'[Cigarettes Per Outer (*)],"Nothing selected")
RETURN
ROUND(
SWITCH(
TRUE(),
selval = 0 && cigpack =180 && cigouter=180, [#Gross_FPV_180],
selval = 0 && cigpack <> 180 && cigouter= <>180, [#Gross_FPV],
selval = 1, [#Gross_otp],
BLANK()
),
3
)

selval = 0 && cigpack =180 && cigouter=180, [#Gross_FPV_180] this condition not working .please any one help me ..

1 ACCEPTED SOLUTION
v-jianpeng-msft
Community Support
Community Support

Hi, @THENNA_41 

Based on the data you provided and the DAX expression, I tested that it works. Here are some of the how-to procedures:

I created three measures using the following DAX expression:

#Gross_FPV = 0
#Gross_FPV_180 = 1
#Gross_otp = -1

vjianpengmsft_0-1714359317714.png

I created a condition using the DAX expression you provided:

vjianpengmsft_1-1714359377624.png

I created a table visual and tested this condition:

vjianpengmsft_2-1714359603452.png

If you see #Gross_FPV_180=1 in measure, you have no problem with your DAX expression. I've uploaded the test file below for you to preview.

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

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

1 REPLY 1
v-jianpeng-msft
Community Support
Community Support

Hi, @THENNA_41 

Based on the data you provided and the DAX expression, I tested that it works. Here are some of the how-to procedures:

I created three measures using the following DAX expression:

#Gross_FPV = 0
#Gross_FPV_180 = 1
#Gross_otp = -1

vjianpengmsft_0-1714359317714.png

I created a condition using the DAX expression you provided:

vjianpengmsft_1-1714359377624.png

I created a table visual and tested this condition:

vjianpengmsft_2-1714359603452.png

If you see #Gross_FPV_180=1 in measure, you have no problem with your DAX expression. I've uploaded the test file below for you to preview.

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

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

 

 

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

Check out the August 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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