Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I am trying to group the results of my measure into buckets with a dax SWITCH statement, but i can't seem to get it to work.
I would expect it to put the Daniel account into bucket 1 and the Robert account into bucket 2
I've had to slowly build my measure to work so this is the layers, starting at the begining:
I have data that looks like this:
My first measure looks like this:
PrincipalBalDailyFirst =
CALCULATE ( MIN ( AccountsHistory[Balance Daily] ), FIRSTDATE ( AccountsHistory[Date] ) )
Second measure
PrincipalBalDailyLast =
CALCULATE ( MIN ( AccountsHistory[Balance Daily] ), LASTDATE ( AccountsHistory[Date] ) )
Difference:
PrincipalBalLastVsFirst = ([PrincipalBalDailyLast]) - [PrincipalBalDailyFirst]
This simply calcualtes for each account, depending on the date range slicer selection, the first balance, the last balance, and the change in balance.
I had to use this measure to get my totals in the pivot table to work, which finally seem to:
Balance Change =
SUMX ( VALUES ( AccountsHistory[Account Num] ), [PrincipalBalLastVsFirst] )
Test measure:
Test = SWITCH (
TRUE (),
SUMX ( VALUES ( AccountsHistory[Account Num] ), [PrincipalBalLastVsFirst] ) < 0, "1",
SUMX ( VALUES ( AccountsHistory[Account Num] ), [PrincipalBalLastVsFirst] )>= 0 && SUMX ( VALUES ( AccountsHistory[Account Num] ), [PrincipalBalLastVsFirst] ) <= 260000, "2",
"3"
)
Now I just want to bucket the results for the Balance Change measure for each account, into buckets. For example, if the change was more than 1 million, call it "greater than 1 milllion balance change" and it can drill down all the accounts in the matrix.
Any help would be appreciated, thanks!
Dave
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
8 | |
7 | |
6 |
User | Count |
---|---|
14 | |
13 | |
11 | |
9 | |
8 |