Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
This is a follow up from the previous question (https://community.powerbi.com/t5/Desktop/Concatenate-rows-values-based-on-DAX-MEASURE-value/m-p/2667...)
I am trying to identify the [Step]s where if the cumulative total is < required balance AND also the first instance where the cumulative total is >= required balance
What I am trying to do is to find out for each specific product, what are the specific [Step] that I should focus on getting to completion and seek them out to meet my [Required balance].
Here [Product], [Step], [Quantity], [Required balance] is part of an actual column, while [Cumulative total] and [Cumulative total < Required balance] is a calculated measure.
2 tables are involved here:
Required balance: [Product], [Required balance]
Quantity: [Product], [Step], [Quantity]
'Required balance'[Product] is linked to 'Quantity'[Product] in a one-to-many relationship.
Product | Step | Quantity | Required balance | Cumulative total | Cumulative total < Required balance |
A | 10 | 12 | 75 | 12 | True |
A | 9 | 71 | 75 | 83 | False |
A | 8 | 12 | 75 | 95 | False |
A | 7 | 48 | 75 | 143 | False |
Ideally my output should be:
Product | Step | Quantity | Required balance | Cumulative total | Cumulative total < Required balance | To be included |
A | 10 | 12 | 75 | 12 | True | True |
A | 9 | 71 | 75 | 83 | False | True |
A | 8 | 12 | 75 | 95 | False | False |
A | 7 | 48 | 75 | 143 | False | False |
Solved! Go to Solution.
Hi @Anonymous ,
Based on the previous measures I have made try the following two measures:
Total cumulative vs required = [CUMULATIVE TOTAL] < SUM('Required Balance'[Required balance])
Steps Selected =
VAR QuantityCumulative =
ADDCOLUMNS (
ALLSELECTED ( Quantity[Step] ),
"@Quantity", [Quantity Value],
"@CumulativeQuantity", [CUMULATIVE TOTAL]
)
VAR QuantityBelowRequired =
COUNTROWS (
FILTER (
QuantityCumulative,
[@CumulativeQuantity] < SUM ( 'Required Balance'[Required balance] )
)
) + 1
RETURN
SELECTEDVALUE(Quantity[Step]) in SELECTCOLUMNS( TOPN ( QuantityBelowRequired, QuantityCumulative, [@CumulativeQuantity], ASC ), "Steps", Quantity[Step]
)
Attach PBIX file updated.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @Anonymous ,
Based on the previous measures I have made try the following two measures:
Total cumulative vs required = [CUMULATIVE TOTAL] < SUM('Required Balance'[Required balance])
Steps Selected =
VAR QuantityCumulative =
ADDCOLUMNS (
ALLSELECTED ( Quantity[Step] ),
"@Quantity", [Quantity Value],
"@CumulativeQuantity", [CUMULATIVE TOTAL]
)
VAR QuantityBelowRequired =
COUNTROWS (
FILTER (
QuantityCumulative,
[@CumulativeQuantity] < SUM ( 'Required Balance'[Required balance] )
)
) + 1
RETURN
SELECTEDVALUE(Quantity[Step]) in SELECTCOLUMNS( TOPN ( QuantityBelowRequired, QuantityCumulative, [@CumulativeQuantity], ASC ), "Steps", Quantity[Step]
)
Attach PBIX file updated.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsAmazing... newfound appreciation for COUNTROWS()
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
99 | |
98 | |
76 | |
66 | |
59 |
User | Count |
---|---|
142 | |
106 | |
103 | |
85 | |
70 |