Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hey! I need some help with a DAX Formula. I have a table with the variaton of the price of the USD respect to ARS (Peso from Argentina) and I have to find out how much money we have spent per month in the USD price of the month that happened. I have 3 main tables (calendar, usd price per working day, and salaries table)
What i need to do is to sum the "Costo Total (Total Cost)" of each month, divide each one of them per the price of the USD in that month, and summarize it all to put it in a card in my dashboard as "Total Cost To Date".
In some cases, i do not have the first date of each month with a price value, so i need to use the first date next to it if theres nothing in the first day of the month
Solved! Go to Solution.
Please make a little bit change to your dax formula.
Best Regards,
Community Support Team _ Caiyun
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. If you still have problems on it, please feel free to let us know. Thanks a lot!
Hi @v-cazheng-msft and @lbendlin , i feel more than grateful for your help, but i couldnt reach the value that i was looking for.
I have tried with the measure thar @v-cazheng-msft post but dont know why it doesnt give me any value, so i will attach de PBI file in this comment so you can check this out if you can. Thanks for your help by the way!
I have 4 pages, the one that im trying to reach the value is the last one (Costos Totales USD). The expected outcome has to be the sum of "Costo Total" of each month, divided by the First value of "Precio Compra" of each month.
Please make a little bit change to your dax formula.
Best Regards,
Community Support Team _ Caiyun
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. If you still have problems on it, please feel free to let us know. Thanks a lot!
You may want to modify your data model
- Eliminate the 1:1 relationships by merging the tables
- correct the employees to sales relationship to 1:M with single direction
- Decide what to do with the dangling Summarize table
- You can also decide to create a new "yearmonth" column in the Dolar and Sueldos tables and use that for the FX rate computation. No need to go via the calendar for that.
Based on the information from you, I think you may try this Measure.
Total Cost to Date =
VAR month_total =
CALCULATE (
SUM ( 'salaries table'[COSTO TOTAL] ),
ALLEXCEPT ( 'calendar', 'calendar'[Month] )
)
VAR min_ =
CALCULATE (
MIN ( 'usd price per working day'[Date] ),
FILTER(ALL('calendar'),'calendar'[Month]=MAX('calendar'[Month]))
)
VAR month_usd =
CALCULATE (
SELECTEDVALUE ( 'usd price per working day'[Purchase] ),
'usd price per working day'[Date] = min_
)
RETURN
month_total/month_usd
The result looks like this:
Attached the pbix file as reference.
Best Regards,
Community Support Team _ Caiyun
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. If you still have problems on it, please feel free to let us know. Thanks a lot!
Please provide sanitized sample data that fully covers your issue. Paste the data into a table in your post or use one of the file services. Please show the expected outcome.
User | Count |
---|---|
16 | |
14 | |
13 | |
12 | |
11 |
User | Count |
---|---|
19 | |
16 | |
15 | |
11 | |
9 |