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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Create Table from SUM of values from other tables


I have created measures called prev1, prev2, cur1, cur2 which are sum of numbers.
Then I created a table called using "Enter Data" button.
In the first column I have entered Item_A, Item_B

I am trying to acheive the below:


Col1 PREV CUR
------ ---- -----
Item_A Prev1 Cur1
Item_B Prev2 Cur2


E.g.:
Col1 PREV CUR
------ ---- -----
Item_A 123 312
Item_B 213 132


I tried the below but it give me a very large number.


PREV = SWITCH([Col1], Item_A", [Prev1])

Also tried this but its the same large number even when I try with CALCULATE
PREV = sumx(FooBar, [Prev1])

 

This may be becasue I have slicers and it ignores the filter context from those slicers. So I have tried ALLSELECTED() but it does not change the figures on a measure:

CALCULATE(sum(Cur1), ALLSELECTED())


Please can someone enlighten me.


Thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I have finally got the this:

 

calculate(SUM(cur), filter(myTable, dateID = related(dateID)))

 

So, I am making sure that the value is calculated by complying to the relationship between the two tables. This way I am making sure that FILTER CONTEXT is intact.

View solution in original post

1 REPLY 1
Anonymous
Not applicable

I have finally got the this:

 

calculate(SUM(cur), filter(myTable, dateID = related(dateID)))

 

So, I am making sure that the value is calculated by complying to the relationship between the two tables. This way I am making sure that FILTER CONTEXT is intact.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors