Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi,
I'm trying to create a new measure in PowerBI Desktop that can sum multiple rows of a colum based on 3 criteria in another column in the same table "G_LEntries".
My "G_LEntries" table is as per below, and I only want to sum "2010", "2011" and "2025".
I will have a slicer on the visual, so the measure must be able to be filtered by date. I have a relationship setup between my date table and the "G_LEntries" table for the slicer for this.
Posting Date | G_L_Account_No | Amount |
15/09/2022 | 2010 | 5 |
01/12/2022 | 2025 | 1.75 |
07/06/2023 | 2010 | 9 |
01/12/2022 | 2011 | 3 |
15/02/2023 | 2011 | 0.33 |
03/05/2022 | 2010 | 100 |
01/01/2021 | 2029 | 99 |
12/01/2022 | 2029 | 36 |
09/06/2023 | 2025 | 1 |
23/02/2022 | 2011 | 0.07 |
23/02/2022 | 2029 | 0.88 |
12/01/2022 | 2025 | 50 |
Solved! Go to Solution.
Hi @AlBud
Whether you want to calculate the sum corresponding to 2011, 2010, 2015, or the sum of these three years separately, the following scenario is to calculate the corresponding sum of the corresponding quantities for these three years.
Measure = var a=SUMMARIZE(FILTER(ALLSELECTED('G_LEntries'),[G_L_Account_No] in {2010,2011,2025}),[G_L_Account_No],"Sum",CALCULATE(SUM(G_LEntries[Amount])))
return IF(SELECTEDVALUE(G_LEntries[G_L_Account_No]) in {2010,2011,2025},MAXX(FILTER(a,[G_L_Account_No]in VALUES(G_LEntries[G_L_Account_No])),[Sum]),SUM(G_LEntries[Amount]))
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 @AlBud
Whether you want to calculate the sum corresponding to 2011, 2010, 2015, or the sum of these three years separately, the following scenario is to calculate the corresponding sum of the corresponding quantities for these three years.
Measure = var a=SUMMARIZE(FILTER(ALLSELECTED('G_LEntries'),[G_L_Account_No] in {2010,2011,2025}),[G_L_Account_No],"Sum",CALCULATE(SUM(G_LEntries[Amount])))
return IF(SELECTEDVALUE(G_LEntries[G_L_Account_No]) in {2010,2011,2025},MAXX(FILTER(a,[G_L_Account_No]in VALUES(G_LEntries[G_L_Account_No])),[Sum]),SUM(G_LEntries[Amount]))
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 Yolo,
This works, thanks!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
144 | |
85 | |
65 | |
51 | |
45 |
User | Count |
---|---|
217 | |
88 | |
81 | |
65 | |
56 |