Forum Discussion
Unfiltered results
- Anonymous1 year ago
Thank You lbendlin and Ashish_Mathur
Hi, samioberoi
I agree with Super User that you should make a dimension table, like your country column. First, I use the following M code to combine the country columns of the two tables and then deduplicate them to form a country dimension table:
let TableA1 = TableA[Country], TableB1 = TableB[Country], res = List.Distinct(List.Combine({TableA1,TableB1})), #"Converted to Table" = Table.FromList(res, Splitter.SplitByNothing(), null, null, ExtraValues.Error), #"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "Country"}}) in #"Renamed Columns"Their relationship is as follows:
Then create a measure using the following expression:
Measure_Subtraction = VAR FilteredA = CALCULATE(SUM(TableA[Amount]),FILTER( TableA, (TableA[Country] = "England" && TableA[LType] = "Type 1") || (TableA[Country] = "Wales" && TableA[LType] = "Type 2") )) VAR FilteredB = CALCULATE(SUM(TableB[Amount]),'TableB'[LType] = "FL Type 2") RETURN FilteredB - FilteredAHere are the results:
I've provided the PBIX file used this time below.
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- 1 year ago
see attached
Hi,
Sorry for me being a naive for this. I don't think there is any common dimension table beween these two tables here. Or am i understanding anything wrongly?
create one if there isn't one.
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.
Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523
- samioberoi1 year ago
Helper III
Hi Ibendlin,
Sorry for the late response. Please find the sample file link here. Don't know if it will open at your end, or please let me know how i can upload the PBI sample file as i struggled to find out an option to upload it here.
Expected results for the measure called "Subtraction_measure" should be like:For Wales --- 1573+104.56 = 1677.56
-67-1677.56 = -1744.56
For England ---- 52.52 - 350.62 = -298.10
.https://drive.google.com/file/d/1XC2C8EU-9T_tax6BWRZ_8soY5pLmmtBS/view?usp=drive_link
Thank you