Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi,
I am trying to find top competitor using below measure.Whenever I am using this measure in the report this is hitting performance very badly.how should I optimise the below measure?Will creating the virtual table "Manuf" in the data source helps?
Top Retailer =
VAR Time =
SELECTEDVALUE ( 'Time'[TimeCalculation] )
VAR Manuf =
FILTER (
ADDCOLUMNS (
SUMMARIZE ( ALLSELECTED ( 'Manufacturer' ), [Manufacturer] ),
"TotalValue",
CALCULATE (
SUM ( 'Sales'[Value] ),
ALL ( 'Time' ),
'Time'[Offset] = 0,
'Time[TimeCalculation] = TimeCalculation,
ALL ( Brand )
)
),
AND (
NOT ( [Manufacturer] ) IN { "abc","xyz"},
NOT ( ISBLANK ( [TotalValue] ) )
)
)
VAR Top1 =
TOPN ( 1, Manuf, [TotalValue], DESC )
RETURN
MAXX ( Top1, [Manufacturer] )
In a post like this and in most cases, the requirement/expectation and sample data are more important than any line of code.
@as1195 ,The information you have provided is not making the problem clear to me. Can you please explain with an example.
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
Appreciate your Kudos.
Hi Amit,
Unfortunaletly I am not able to attach sample file here.Please find the snippet for the same.
Manufacturer table holds unique manufacturer.
Manufacture pivot table has Top Competitor defined for each of the manufacturer along with inidvidual manufacturer.
Sales table holds sales and other details.
Time table holds Latest12Weeks and Latest4week data.
What I am trying to find is the Top Retailer .For ex
For Egypt & Vegetables, when Top Competitor is selected from slicer the query should hit all the Egypt and Vegetables combination from sales tables and give the highest sales manufacturer as a result.
When user selects any other manufacturer other than Top Competitor,the sales values should show against the selected manufacturer
Top Retailer Measure=
User | Count |
---|---|
53 | |
28 | |
19 | |
18 | |
14 |
User | Count |
---|---|
92 | |
86 | |
39 | |
23 | |
22 |