Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
i have a switch case that is showing different values for each row in a matrix
i have a table that shows the income, expenses and my cashflow per week.
This is how the matrix should show values:
Row 1: show cashflow
Row 2: show net cashflow this week + previous week balance
row 3 and further: show net cashflow this week + the values from row 2
i have problem with row 3 and further.
This is the code i have now:
How can i make the third row calculate this weeks net cash and subsctract the last weeks balance
my date table have weeknumber column. and the report uses week and year slicer.
Its still not giving me the correct result..
@Robin96 Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882
Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
@Greg_Deckler
This is the data i have as test
This is the expected output i want:
The orange fields is what i use for the the calculation, and the green field is where i want the result
Hi
Please try this
Cashflow =
VAR minweek =
MIN ( RT[Week] )
VAR Firstcash =
CALCULATE ( MAX ( RT[Cash Balance] ), RT[Week] = minweek, ALL ( rt ) )
VAR Activweek = RT[Week]
VAR RTotal =
CALCULATE (
SUM ( RT[Net Cashflow] ),
RT[Week] > minweek
&& RT[Week] <= Activweek,
ALL ( RT )
)
VAR result =
IF ( Activweek = minweek, Firstcash, RTotal + Firstcash )
RETURN
result
Hey,
Thanks for the response! This did not generate the desired outcome. i dont have every column in the same table as you have here.
i also get an error on the syntax at "Activweek" not sure why, guess it needs an expression.
Sorry I do not realize that you got informations in different tables
For Activweek, as you put it on a matrix use the selectedvalue(Date[Week])
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 37 | |
| 37 | |
| 33 | |
| 32 | |
| 29 |
| User | Count |
|---|---|
| 130 | |
| 88 | |
| 82 | |
| 68 | |
| 64 |