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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
jmab
New Member

Summarize giving different data if I add extra groupBy_columnName

I have data that looks something like this, with other columns of data, too. 

UserIDSessionIDBC
510
520
530
641
650
760
770
781
890
8100
9110
10121
10131
11140
11151

 

Some of the data have blanks and/or incorrect data, as there are new categories being added and bugs fixed at each of our releases.

 

My goal is to get a count of the unique UserIDs that never have a BC count of 1, and then build a histogram to count the number of sessions each user has done.

 

I've used this to separate users into buckets:

 

UserIDUniqueness =
VAR varCurrentValue = myData[UserID]
VAR varInstances =
    COUNTROWS(
        FILTER(
            myData,
            myData[UserID] = varCurrentValue
        )
    )
var Result =
    IF(
        varInstances = 1,
        "Unique",
        IF(
            varInstances > 1 && varInstances <= 5,
            "Bucket1",
            IF(
                varInstances > 5 && varInstances <= 10,
                "Bucket2",
                IF(
                    varInstances > 10 && varInstances <= 15,
                    "Bucket3",
                    IF(
                        varInstances > 15 && varInstances <= 20,
                        "Bucket4",
                        IF(
                            varInstances > 20 && varInstances <= 25,
                            "Bucket5",
                            IF(
                                varInstances > 25 && varInstances <= 30,
                                "Bucket6",
                                "BucketMore"
                            )
                        )
                    )
                )
            )
        )
    )
RETURN
    Result
 
And this works. Now, when I create the histogram table, I am doing:
 
UserUniqueness = FILTER (
    SUMMARIZE(
        'myData',
        myData[ApplicationUserType],
        "UniqueTotal", CALCULATE(
            DISTINCTCOUNT('myData'[UserID]),
            myData[UserIDUniqueness] = "Unique",
            myData[ApplicationVersion] <> "0.0.0.0",
            myData[ApplicationVersion] <> "0.1.0.0",
            myData[ApplicationVersion] <> "20.3.0.0"
        ),            
        "Bucket1Total", CALCULATE(
            DISTINCTCOUNT('myData'[UserID]),
            myData[UserIDUniqueness] = "Bucket1",
            myData[ApplicationVersion] <> "0.0.0.0",
            myData[ApplicationVersion] <> "0.1.0.0",
            myData[ApplicationVersion] <> "20.3.0.0"    
        ),
        "Bucket2Total", CALCULATE(
            DISTINCTCOUNT('myData'[UserID]),
            myData[UserIDUniqueness] = "Bucket2",
            myData[ApplicationVersion] <> "0.0.0.0",
            myData[ApplicationVersion] <> "0.1.0.0",
            myData[ApplicationVersion] <> "20.3.0.0"  
        ),
        "Bucket3Total", CALCULATE(
            DISTINCTCOUNT('myData'[UserID]),
            myData[UserIDUniqueness] = "Bucket3",
            myData[ApplicationVersion] <> "0.0.0.0",
            myData[ApplicationVersion] <> "0.1.0.0",
            myData[ApplicationVersion] <> "20.3.0.0"  
        ),
        "Bucket4Total", CALCULATE(
            DISTINCTCOUNT('myData'[UserID]),
            myData[UserIDUniqueness] = "Bucket4",
            myData[ApplicationVersion] <> "0.0.0.0",
            myData[ApplicationVersion] <> "0.1.0.0",
            myData[ApplicationVersion] <> "20.3.0.0"  
        ),
        "Bucket5Total", CALCULATE(
            DISTINCTCOUNT('myData'[UserID]),
            myData[UserIDUniqueness] = "Bucket5",
            myData[ApplicationVersion] <> "0.0.0.0",
            myData[ApplicationVersion] <> "0.1.0.0",
            myData[ApplicationVersion] <> "20.3.0.0"    
        ),
        "Bucket6Total", CALCULATE(
            DISTINCTCOUNT('myData'[UserID]),
            myData[UserIDUniqueness] = "Bucket6",
            myData[ApplicationVersion] <> "0.0.0.0",
            myData[ApplicationVersion] <> "0.1.0.0",
            myData[ApplicationVersion] <> "20.3.0.0"    
        ),
        "BucketMoreTotal", CALCULATE(
            DISTINCTCOUNT('myData'[UserID]),
            myData[UserIDUniqueness] = "BucketMore",
            myData[ApplicationVersion] <> "0.0.0.0",
            myData[ApplicationVersion] <> "0.1.0.0",
            myData[ApplicationVersion] <> "20.3.0.0"
        )
    ),
    NOT(myData[ApplicationUserType] = "")
)
and this gives me a nice histogram.
 
BUT, if I add another groupBy_columnName
 
UserUniqueness = FILTER (
    SUMMARIZE(
        'myData',
        myData[ApplicationUserType],
        myData[ApplicationVersion],
        "UniqueTotal", CALCULATE(
        .....
 
then my histogram has totally different data counts, which I don't understand.
 
Any ideas?
2 REPLIES 2
asitm
Helper III
Helper III

@jmab  it's going to be simpler if you use one of the histograms from appsource - there are both free and paid ones.

https://appsource.microsoft.com/en-us/marketplace/apps?search=histogram&ocid=1158848_20231030_histog... 


parry2k
Super User
Super User

@jmab seems like you are over killing everything but the reason could be because this produce a unique row

        myData[ApplicationUserType],
        myData[ApplicationVersion],
 

and the unique count of users for the above combination which will be different if you are doing summaries only on usertype



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors