Forum Discussion
If statement doesn't work
Hello,
I have a problem with IF statement which is not working perfectly, do you have any idea why it is not working very well?
5 Replies
- amitchandakSuper User
elif , If this is a column, this will not work
POS Type NEW = IF([is grater] = 1, "NPI", 'Product'[POS type])
It needs to be a measure
example
POS Type NEW = IF([is grater] = 1, "NPI", max('Product'[POS type]) )
- elifFrequent Visitor
Hi amitchandak
I tried both of them but still not working. When I try your suggestion it gives me just 2 Product Type but has to be 5 like Core Product, Identity, NPI, Custom, outofscope, and the NPI calculation is wrong as well.
- amitchandakSuper User
elif , This will not work as column,
You have create a measure as, you are using measure in calculation
POS Type NEW = IF([is grater] = 1, "NPI", max('Product'[POS type]) )
Not get this working as a Column, you need an independent table(assume POS Type) with these two values. using a group by NPI name you need create a new measure to get this working
new Measure
Sumx(filter(Values(Table[MPI Name]), [POS Type NEW] = max(POS Type[POS Type])), [measure])refer this blog or video for steps
Dynamic Segmentation Bucketing Binning
https://community.powerbi.com/t5/Quick-Measures-Gallery/Dynamic-Segmentation-Bucketing-Binning/m-p/1387187#M626
Dynamic Segmentation, Bucketing or Binning: https://youtu.be/CuczXPj0N-k
- v-yalanwu-msftCommunity Support
Hi, elif ;
Can you share a simple data removing sensitive information, along with the results you want to output?
It makes it easier to give you a solution.Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. - v-yalanwu-msftCommunity Support
Hi, elif ;
Is your problem solved? If so, Would you mind accept the helpful replies as solutions? Then we could close the thread. More people who have the same requirement will find the solution quickly and benefit here. Thank you.
Best Regards,Community Support Team_ Yalan WuIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.