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
carlomendoza
Regular Visitor

PowerBI Bin Feature not giving the same result as Excel FREQUENCY()

I just tried out the group bin feature in PowerBI desktop, but it seems it doesn't behave the same way as Excel's FREQUENCY() function. See picture. Is there a way make it match how FREQUENCY works? Don't mind the colors and bar widths. I'm talking about the values of the bars being different.

 

Untitled234234.png

 

 

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @carlomendoza,

 

The Group bin feature in PowerBI desktop is not the same as that in Excel. It only supports specific interval (bin size) that displayed in x-axis. For example, the x-axis can show value like 0,5,10,15,etc, but cannot show values as 0,5,6,8,9,etc. which is supported in Excel. That is the reason why the values of the bars are different.

 

In PowerBI, you can try the workaround below. First, you need a table with bin data and add an index column (in query edit) to it. Use the following formula to add an calculate column:

BinStart =
SUMX (
    FILTER ( BinTable, BinTable[index2] = EARLIER ( BinTable[index2] ) - 1 ),
    BinTable[BinEnd]
)


3.PNG            4.PNG

Then, cross join the Bin table with the table which contains the value columns need to be count. Create a calculate table based on that crossjoin table: 

CrossJoin = CROSSJOIN(Bin,BinTable)

NewTable =
CALCULATETABLE (
    'CrossJoin',
    FILTER (
        'CrossJoin',
        'CrossJoin'[Values] > 'CrossJoin'[BinStart]
            && 'CrossJoin'[Values] <= 'CrossJoin'[BinEnd]
    )
)

column = NewTable[BinStart]&"~"&NewTable[BinEnd]

5.PNG

 

Then, use the last table view to create bar chart. 

6.PNG

 

Thanks,
Yuliana Gu

Community Support Team _ Yuliana Gu
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

5 REPLIES 5
carlomendoza
Regular Visitor

Are there new features that make this easier?

 Yes, now its much easier. PowerBI has a "group" feature that you can use. Simply right click on the Field and select New Group and you can do it that way. 

v-yulgu-msft
Employee
Employee

Hi @carlomendoza,

 

The Group bin feature in PowerBI desktop is not the same as that in Excel. It only supports specific interval (bin size) that displayed in x-axis. For example, the x-axis can show value like 0,5,10,15,etc, but cannot show values as 0,5,6,8,9,etc. which is supported in Excel. That is the reason why the values of the bars are different.

 

In PowerBI, you can try the workaround below. First, you need a table with bin data and add an index column (in query edit) to it. Use the following formula to add an calculate column:

BinStart =
SUMX (
    FILTER ( BinTable, BinTable[index2] = EARLIER ( BinTable[index2] ) - 1 ),
    BinTable[BinEnd]
)


3.PNG            4.PNG

Then, cross join the Bin table with the table which contains the value columns need to be count. Create a calculate table based on that crossjoin table: 

CrossJoin = CROSSJOIN(Bin,BinTable)

NewTable =
CALCULATETABLE (
    'CrossJoin',
    FILTER (
        'CrossJoin',
        'CrossJoin'[Values] > 'CrossJoin'[BinStart]
            && 'CrossJoin'[Values] <= 'CrossJoin'[BinEnd]
    )
)

column = NewTable[BinStart]&"~"&NewTable[BinEnd]

5.PNG

 

Then, use the last table view to create bar chart. 

6.PNG

 

Thanks,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi,

 

I just found a much easier and faster way to do the same thing.  All you have to do is go into edit queries and add a conditional column.  Then start from the largest bin and start adding conditions "greater than" next interval.  See full example here:  http://exceleratorbi.com.au/conditional-columns-power-bi-desktop/

 

After you add the conditional column, you can then create visuals on that conditional column.  

KUDOS!!  It does work, but It takes a loonnggg time to follow & create 3 tables just to put the counts into bins!  Wow, excel is much easier, just one simple 10-sec function called "Frequency".  Power BI needs to do something about that!  But thanks so much for your help!

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.