Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
How many apples are there at each Farm (with DAX)
| Farm | Barrel | Apples | Taster | Vote |
| North Farm | Green Barrel | 150 | John | Sweet |
| North Farm | Green Barrel | 150 | Sue | Sweet |
| North Farm | Red Barrel | 150 | John | Bitter |
| South Farm | Blue Barrel | 200 | John | Sweet |
| South Farm | Blue Barrel | 200 | Sue | Sweet |
| South Farm | Pink Barrel | 300 | John | Sweet |
| South Farm | Pink Barrel | 300 | Sue | Bitter |
| South Farm | Pink Barrel | 300 | Carol | Sweet |
| South Farm | Red Barrel | 50 | Carol | Bitter |
We want to create a measure which would sum the quantity of any Farm or any Barrel?
Like the Apple Measure shown below for example ...
Farm,Barrel,Apples,Taster,Vote
North Farm,Green Barrel,150,John,Sweet
North Farm,Green Barrel,150,Sue,Sweet
North Farm,Red Barrel,150,John,Bitter
South Farm,Blue Barrel,200,John,Sweet
South Farm,Blue Barrel,200,Sue,Sweet
South Farm,Pink Barrel,300,John, Sweet
South Farm,Pink Barrel,300,Sue,Bitter
South Farm,Pink Barrel,300,Carol,Sweet
South Farm,Red Barrel,50,Carol,Bitter
Solved! Go to Solution.
Hi, @roberts_stats
You can consider add a summarized table to remove the duplicates records and keep the valid record columns.
Calculated Table:
Table 2 = SUMMARIZE('Table','Table'[Farm],'Table'[Barrel],'Table'[Apples])
Then you can perform calculations based on this summary table.
From the summary table you can easily tell how many apples are there at each Farm.
Best Regards,
Community Support Team _ Eason
Hi, @roberts_stats
You can consider add a summarized table to remove the duplicates records and keep the valid record columns.
Calculated Table:
Table 2 = SUMMARIZE('Table','Table'[Farm],'Table'[Barrel],'Table'[Apples])
Then you can perform calculations based on this summary table.
From the summary table you can easily tell how many apples are there at each Farm.
Best Regards,
Community Support Team _ Eason
Hi,
I am going to give a few pointers which should help you to solve this issue:
You can use CALCULATE to modify filter context of a measure/function by using functions such as ALL, REMOVEFILTERS, ALLEXCEPT. E.g. ALL(Table[column]) will remove filters affecting that column.
The use case you are describing is common and I recommend checking these resources to understand more:
Introducing CALCULATE in DAX - SQLBI
CALCULATE function (DAX) - DAX | Microsoft Learn
Filter context in DAX - SQLBI
I believe you can create your measure after reading these.
I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/
Proud to be a Super User!
Hi @ValtteriN
Thanks your answer, I'm going to edit and clarify my question a little because I don't believe those links resolve this question necessarily.
We want to create a measure which would sum the quantity of any Farm or any Barrel, not just filtering the sum to find one Barrel or one Farm.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 6 | |
| 6 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 21 | |
| 10 | |
| 10 | |
| 5 | |
| 5 |