March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
Register NowGet certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
Hi,
I have 2 tables
1) Sales tables (daily)
2) Forecast tables (monthly)
(Both are link to my look up tables : product, customer, calendar)
I am trying to have a measure that would help my compare the total per different caterogies (1st step is the SalesRep)
But every measure i've tried only calculate totals and i cannot use my different filter
Ex : Want to compare total of sales at the end of may per REP vs their forecast. Then i'll want to compare client by client... etc... so it has to be dynamic based on the date.
Any tips on how to write this ? I am really new with Dax and struggling a bit here.
Solved! Go to Solution.
@PeterVachon ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
Need to try with data
Hi @PeterVachon ,
This is the data I created:
Sales tables:
Forecast tables:
look up tables:
Here are the steps you can follow:
1. Create measure.
alltoal =
var _select=
SELECTEDVALUE('look up table'[date])
return
CALCULATE(SUM('Sales tables'[amount]),FILTER(ALL('Sales tables'),'Sales tables'[Customer]=MAX('Sales tables'[Customer])&&'Sales tables'[Month]=MONTH(_select)))
Forecastamount =
var _select=SELECTEDVALUE('look up table'[date])
return
CALCULATE(SUM('Forecast tables'[Amount]),FILTER(ALL('Forecast tables'),'Forecast tables'[monthly]=MONTH(_select)&&'Forecast tables'[Customer]=MAX('Forecast tables'[Customer])))
Flag =
IF(MAX('Sales tables'[date]) in SELECTCOLUMNS('look up table',"1",[date]),1,0)
Flag1 =
IF(MAX('Forecast tables'[monthly]) in SELECTCOLUMNS('look up table',"1",MONTH('look up table'[date])) ,1,0)
2. Put [Flag] and [Flag1] into the Filter of the corresponding visual object respectively, is=1, apply filter.
3. Put [date] of the look up table table into the slicer, according to the selected date, to display the corresponding total sales and monthly forecast value, and compare
4. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @PeterVachon ,
This is the data I created:
Sales tables:
Forecast tables:
look up tables:
Here are the steps you can follow:
1. Create measure.
alltoal =
var _select=
SELECTEDVALUE('look up table'[date])
return
CALCULATE(SUM('Sales tables'[amount]),FILTER(ALL('Sales tables'),'Sales tables'[Customer]=MAX('Sales tables'[Customer])&&'Sales tables'[Month]=MONTH(_select)))
Forecastamount =
var _select=SELECTEDVALUE('look up table'[date])
return
CALCULATE(SUM('Forecast tables'[Amount]),FILTER(ALL('Forecast tables'),'Forecast tables'[monthly]=MONTH(_select)&&'Forecast tables'[Customer]=MAX('Forecast tables'[Customer])))
Flag =
IF(MAX('Sales tables'[date]) in SELECTCOLUMNS('look up table',"1",[date]),1,0)
Flag1 =
IF(MAX('Forecast tables'[monthly]) in SELECTCOLUMNS('look up table',"1",MONTH('look up table'[date])) ,1,0)
2. Put [Flag] and [Flag1] into the Filter of the corresponding visual object respectively, is=1, apply filter.
3. Put [date] of the look up table table into the slicer, according to the selected date, to display the corresponding total sales and monthly forecast value, and compare
4. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
To better explain, I've tried splitting up my formual to see what is going on.
1st part of my formula isn't working correctly it returns the TOTAL sales YTD and doesn't spread per REP as i would like it to in my matrix,
@PeterVachon , Not very clear on the issue. Becuase if you have calendar table, joined to both tables, then you can compare actual and forecast values monthly
if sales rep is not a common dimesion, then you can not compare that.
If handeling date is an issue refer
Distributing/Allocating the Monthly Target(Convert to Daily Target): Measure ( Daily/MTD): https://community.powerbi.com/t5/Community-Blog/Power-BI-Distributing-Allocating-the-Monthly-Target-...
What i am trying to do is write a measure that with take my Total Sales - Forecast and be able to spread it out per REP or customer. Depending on how I present my Matrix/Table. If i only use a quick measure it doesn't work and doesn't spread correctly.
But, I keep getting only the TOTAL.
My filter regardings the dates is working well... no worry.
BTW : Thx for your link this will come up handy real soon 😉 !
@PeterVachon ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
Need to try with data
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
Check out the November 2024 Power BI update to learn about new features.
User | Count |
---|---|
118 | |
96 | |
87 | |
71 | |
62 |
User | Count |
---|---|
138 | |
116 | |
114 | |
99 | |
98 |