Forum Discussion
Simulated Weighted Average Payment Term using What-If Parameter
- Anonymous1 year ago
Hi KB88 ,
Thank you again for the update!Since you have already created a disconnected Vendor table, the key is to ensure you're using that disconnected table in your slicer ,not the one that is linked to SC data.If the slicer is based on a table with a relationship, it will still filter the data and affect the weighted average calculation.
Please double-check that the slicer is pointing to the disconnected Vendor table only. Once that is confirmed, your logic might work correctly across all vendors.
Did you get a chance to review my earlier response? If not, please have a look on it and let us know.
Thank you.
Hi KB88 ,
You're on the right track with your Weighted Average Payment Term (WAPT) formula, and now you want to simulate what would happen if a vendor’s payment term changes—say, if Vendor B switches entirely to 60-day terms. To do this using a What-If parameter, you'll need to override the existing payment term logic for just that vendor using the parameter value.
Start by creating a What-If parameter in Power BI. Go to Modeling > New Parameter, name it something like New Vendor PT, and set it up with values between 0 and 120 in increments of 5. This creates a new disconnected table with a column [New Vendor PT] and a measure that looks like this:
New Vendor PT Value = SELECTEDVALUE('New Vendor PT'[New Vendor PT], 60)
Now, we want to use this parameter to simulate the new payment term days—but only for Vendor B. So you’ll modify your original WAPT measure to conditionally use the parameter value when the vendor is Vendor B, and otherwise fall back to the actual related days.
Here's the full DAX measure:
SimulatedWeightedAvgPT =
VAR SimVendor = "Vendor B"
VAR SimDays = [New Vendor PT Value]
RETURN
DIVIDE(
SUMX(
'SC Data',
VAR VendorName = 'SC Data'[Vendor Name]
VAR OriginalPT = RELATED('Payment Terms'[Days])
VAR SpendAmt = 'SC Data'[Spend]
VAR DaysToUse =
IF(VendorName = SimVendor, SimDays, OriginalPT)
RETURN DaysToUse * SpendAmt
),
SUM('SC Data'[Spend])
)
Drop the New Vendor PT slicer onto your report page. Now when you adjust the slicer, the measure will dynamically calculate the new weighted average assuming all of Vendor B’s transactions have the chosen term. If you'd like to simulate this for a different vendor, just replace "Vendor B" with the name of the other vendor, or make it dynamic by using a slicer and a SELECTEDVALUE() reference to the vendor name.
Best regards,
This was extremely helpful, thank you!
One thing, this shows an individual vendor. So If I am changing the days for Vendor B, the Sim WAPT will be 60 days, but now I want to put the sim WAPT back into the original formula. So all other vendors still have their original PT and vendor be is set to 60. I am using a slicer to pick different vendors to see how this affects the WAPT depending which vendor we can raise.
Using my Sample data the original WAPT for all is 40.33, but if I changed Vendor B to 60 days, the simulated WAPT would be 48.92!