Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
BunzietheBoo
Advocate II
Advocate II

[DAX] How to apply a multiplier on a Parameter based on a Date and another parameter

Hello all, 

First post for me here on a problem I have for a few days.
I am working on a dashboard displaying sales data for a bunch of shops.
To be properly interpreted, the sales numbers has to be adjusted by a multiplier.
This multiplier is different for every shop and is changing through time.

The multiplier values are stored in a "Multiplier" table  :

ShopIDDateMultiplier
101.01.20181
101.01.20201.2
201.01.20181.1
302.03.20191.05


On the other end, the sales values are stored in another "Sales"table :

ShopIDDateSalesNb
101.01.2018545
201.01.2018362
301.01.2018421
102.01.2018532
202.01.2018350
(...)(...)(...)


I also have a "DateTable" where I store all the date input of my data model and a "Shop" Table.
Regarding the relationships : 
"DateTable"    1 ---->-----*    "Sales"
"Shop"            1 ---->---- *    "Sales"
"Shop"            1 ---->-----*    "Multiplier"
"DateTable"    1 ---->---- *    "Multiplier"

My goal is to have a measure that return for a given asset and for a given date, the multiplier that should be apply to the Sales number.


This measure will then be used in a SWITCH measure to allow the user to pick if they want the adjusted number or not.
Good luck and tell me if you want more information !

1 ACCEPTED SOLUTION

Some DAX to add it as a calculated column to Sales would be 

Multiplier = 
VAR _Shop = Sales[ShopID]
VAR _Date = Sales[Date]
VAR _Latest = 
TOPN(
    1,
    FILTER(Multiplier, Multiplier[Date] <= _Date && Multiplier[ShopID] = _Shop),
    Multiplier[Date], DESC
)
RETURN
MAXX(_Latest, Multiplier[Multiplier])

The measure is then relatively simple

Sales with Multiplier = 
SUMX(
    Sales,
    Sales[SalesNb] * Sales[Multiplier]
)

View solution in original post

2 REPLIES 2
PaulOlding
Solution Sage
Solution Sage

Hi @BunzietheBoo 

Have you thought about adding the Multiplier to the Sales table, either in Power Query or the source?

From a modelling perspective that's where it should go if you're going to use it in a measure.

The resulting measure will also perform better - something to consider if you have a large amount of data.

Some DAX to add it as a calculated column to Sales would be 

Multiplier = 
VAR _Shop = Sales[ShopID]
VAR _Date = Sales[Date]
VAR _Latest = 
TOPN(
    1,
    FILTER(Multiplier, Multiplier[Date] <= _Date && Multiplier[ShopID] = _Shop),
    Multiplier[Date], DESC
)
RETURN
MAXX(_Latest, Multiplier[Multiplier])

The measure is then relatively simple

Sales with Multiplier = 
SUMX(
    Sales,
    Sales[SalesNb] * Sales[Multiplier]
)

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.