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.
Good day everyone,
I am attaching the PowerBi file.https://drive.google.com/file/d/1HWX0sZt1FZ_JnZCnSu9OTAwhhhum8azq/view?usp=sharing
I don't know how to subtract the values, which in some cases are positive and in others negative. The principle is as follows, from table lib it is calculated for table t1, column 1 line_1+line_3, then it goes to table met. In table met, it is looked at for each month separately, line_1 covers ran 1,2, and line_3 covers ran 1,2,4. Then we go to the fact table and read the values, which are finally added or subtracted. In the fact table, for the month of January, ran 1 = 5, ran 2 = 8....In the end, the calculation looks like this: 5+8+5+8+5 = 31. And so for every month. Here is another example when we also have subtraction. We also go to table lib first, there we read for table t1, column 2 = line_1 - line_3. Now it is minus because the sign is -1, then we go to table met and read what line_1 and line_3 include, that is, which ran. We arrive at the formula 1+2-1-2-4. We go to the fact table to read these values and we get that the result is 5+8-5-8-5 = -5 for the month of January.
Here is a display and table of how the results should look.
January | February | March | Total | |
t1 | 26 | 30 | 12 | 68 |
1 | 31 | 35 | 17 | 83 |
2 | -5 | -5 | -5 | -15 |
t2 | -37 | -43 | -20 | -100 |
1 | -19 | -23 | -9 | -51 |
2 | -18 | -20 | -11 | -49 |
Thanks in advance.
Solved! Go to Solution.
Hi @maricci
Based on your description, I create the following measure.
Measure = sumx(VALUES('met'[line]),SUM('fact'[amount]))
Measure 2 = IF(ISINSCOPE(met[ran]),[Measure],IF(ISINSCOPE(lib[line]),MAX(lib[sign])*[Measure]))
Measure 3 = SUMX(VALUES(lib[line]),[Measure 2])
Measure 4 = SUMX(VALUES(lib[column]),[Measure 3])
Measure 5 = SUMX(VALUES(lib[table]),[Measure 4])
Then put the meaure 5 to the value.
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @maricci
Based on your description, I create the following measure.
Measure = sumx(VALUES('met'[line]),SUM('fact'[amount]))
Measure 2 = IF(ISINSCOPE(met[ran]),[Measure],IF(ISINSCOPE(lib[line]),MAX(lib[sign])*[Measure]))
Measure 3 = SUMX(VALUES(lib[line]),[Measure 2])
Measure 4 = SUMX(VALUES(lib[column]),[Measure 3])
Measure 5 = SUMX(VALUES(lib[table]),[Measure 4])
Then put the meaure 5 to the value.
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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 |