Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
How can I make a DAX formula MTD for only full months. So March has not ended yet so it has to be till Februari with this formula :
Cal. year / month.Cal. year / month Level 01 | Maandnummer | Cal. year / month.Cal. year / month Level 01.Key.2 | Cal. year / month.Cal. year / month Level 01.Long Name.1 | Cal. year / month.Cal. year / month Level 01.Long Name.2 | Abs Diff M - 3 | Order Quantity |
JAN 2021 | 1 | 2021 | January | 2021 | 50 | 100 |
JAN 2021 | 1 | 2021 | January | 2021 | 60 | 400 |
JAN 2021 | 1 | 2021 | January | 2021 | 63 | 148 |
FEB 2021 | 2 | 2021 | February | 2021 | 490 | 1640 |
FEB 2021 | 2 | 2021 | February | 2021 | 4 | 25 |
MAR 2021 | 3 | 2021 | March | 2021 | 10 | 700 |
MAR 2021 | 3 | 2021 | March | 2021 | 40 | 200 |
Hi @Anonymous
Can you post sample data as text and expected output?
Not enough information to go on;
please see this post regarding How to Get Your Question Answered Quickly:
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
4. Relation between your tables
Appreciate your Kudos!!
LinkedIn:www.linkedin.com/in/vahid-dm/
I read your advice and hopefully this will clarify a bit.
Cal. year / month.Cal. year / month Level 01 | Maandnummer | Cal. year / month.Cal. year / month Level 01.Key.2 | Cal. year / month.Cal. year / month Level 01.Long Name.1 | Cal. year / month.Cal. year / month Level 01.Long Name.2 | Abs Diff M - 3 | Order Quantity |
JAN 2021 | 1 | 2021 | January | 2021 | 50 | 100 |
JAN 2021 | 1 | 2021 | January | 2021 | 60 | 400 |
JAN 2021 | 1 | 2021 | January | 2021 | 63 | 148 |
FEB 2021 | 2 | 2021 | February | 2021 | 490 | 1640 |
FEB 2021 | 2 | 2021 | February | 2021 | 4 | 25 |
MAR 2021 | 3 | 2021 | March | 2021 | 10 | 700 |
MAR 2021 | 3 | 2021 | March | 2021 | 40 | 200 |
When it is for instance half March it should calculate only the sum of Jan/Feb M-3 = 667 divide by sum Jan/Feb order quantity = 2313 = expected output = 29%
Hi, @Anonymous
If you have a seperated calendar table without any relationship, you can try the formula as below:
Result =
VAR _today =
SELECTEDVALUE ( 'Calendar table'[Date] )
VAR a =
CALCULATE (
SUM ( 'Table'[Abs Diff M - 3] ),
FILTER (
ALL ( 'Table' ),
'Table'[Cal. year / month.Cal. year / month Level 01]
< STARTOFMONTH ( 'Calendar table'[Date] )
)
)
VAR b =
CALCULATE (
SUM ( 'Table'[Order Quantity] ),
FILTER (
ALL ( 'Table' ),
'Table'[Cal. year / month.Cal. year / month Level 01]
< STARTOFMONTH ( 'Calendar table'[Date] )
)
)
RETURN
a / b
Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
23 | |
12 | |
10 | |
10 | |
8 |
User | Count |
---|---|
16 | |
15 | |
15 | |
12 | |
10 |