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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
curiouspbix0
Helper IV
Helper IV

What is incorrect in this simple IF formula

StateStation
NewyorkS1
NewyorkS2
CaliforniaS3
CaliforniaS4
CaliforniaS5

 

Expected   
StateStation CountGroup 
Newyork2Two 
California33 or More 
    
Actual-incorrect   
StateStation CountGroup 
Newyork2Two 
California3Two 

What is incorrect in the below formula for Group ? Result is incorrect as shown above.

 

Station Count=DistinctCount(Table([Station])
Group =If ([Station Count]>2,"3 or More","Two"

1 ACCEPTED SOLUTION

Hi, @curiouspbix0 

According to your description, I think that you want to convert the measure into a calculated column so that you can use it in the Slicer, am I right?

You can try my columns:

Station Count1 = CALCULATE(DistinctCount('Table'[Station]),ALLEXCEPT('Table','Table'[State]))
Group1 = If ([Station Count1]>2,"3 or More","Two")

 

And you can get what you want, like this:

屏幕截图 2020-11-02 140113.png

 

You can download my test pbix file here

 

If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

How to Get Your Question Answered Quickly 

 

Best Regards,

Community Support Team _Robert Qin

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

9 REPLIES 9
v-robertq-msft
Community Support
Community Support

Hi, @curiouspbix0 

I have tried your measure, it can work correctly, you should check it again. If you still have a problem, you can try my Calculated table, it can work as good:

Expected =

SUMMARIZE('Table',

[State],

"Station Count",DISTINCTCOUNT('Table'[Station]),

"Group",IF([Station Count]>=3,"3 or More","Two"))

 

And you can get what you want, like this:

v-robertq-msft_0-1604041433887.png

 

You can download my test pbix file here

 

If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

How to Get Your Question Answered Quickly 

 

Best Regards,

Community Support Team _Robert Qin

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

harshnathani
Community Champion
Community Champion

Hi @curiouspbix0 ,

 

Seems to work fine with the measures.

 

1.jpg2.JPG

 

 

Station Count = DISTINCTCOUNT('Table'[Station])



Group = If ([Station Count]>2,"3 or More","Two")

 

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

CNENFRNL
Community Champion
Community Champion

Hi, @curiouspbix0 , all seems to work correctly on my side

Screenshot 2020-10-29 105257.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Fowmy
Super User
Super User

@curiouspbix0 

Do the Measure in this way:

Station Count = 
IF( COUNTROWS(Table1) > 2 , "3 or More","Two")

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Why would a column not work but a measure works for the same formula ? Aggregation ?

There are additional columns in the table that are not listed up in the sample.


Cannot add measure to a drop down filter, how do you get the column working ?

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

What is the Bracker formula ( Column ) ? Not available in PBIX

 

Measure works fine, how about the column so slicer works.

Hi,

I do not know whom you are replying to?  Doesn't my solution solve your question?  It is a measure solution and as you can see there is also a slicer.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi, @curiouspbix0 

According to your description, I think that you want to convert the measure into a calculated column so that you can use it in the Slicer, am I right?

You can try my columns:

Station Count1 = CALCULATE(DistinctCount('Table'[Station]),ALLEXCEPT('Table','Table'[State]))
Group1 = If ([Station Count1]>2,"3 or More","Two")

 

And you can get what you want, like this:

屏幕截图 2020-11-02 140113.png

 

You can download my test pbix file here

 

If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

How to Get Your Question Answered Quickly 

 

Best Regards,

Community Support Team _Robert Qin

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors