The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
Im looking to display a table that looks like this :
Month | M -12 | M -11 | M -10 | M -9 | M -8 | M -7 | M -6 | M -5 | M -4 | M -3 | M -2 | M -1 | M 0 - MTD |
INV | |||||||||||||
DOH | |||||||||||||
COGS |
For the M1 calculation will include dates between today-29 to today-59. M2 will be today-59 to today - 89. Is there a simpler way for me to do rather than creating a measure for each of it which will give me around 36 measures ?
Any help is appreciated.
Thanks in advance !
Solved! Go to Solution.
Hi @Velvetine27
>> calculation for past 30 days
I create an example for your reference, please try this,
Measure =
var _header= MAX('Dimension'[Dimension])
return
SWITCH(TRUE(),
_header="M 0 - MTD",SUMX(FILTER('Table','Table'[Date]<=TODAY() && 'Table'[Date]>= EDATE(TODAY(),-1)),[Value]), // -30 day
_header="M -1", SUMX(FILTER('Table','Table'[Date]< EDATE(TODAY(),-1) && 'Table'[Date]>= EDATE(TODAY(),-2)),[Value]),
_header="M -2", SUMX(FILTER('Table','Table'[Date]< EDATE(TODAY(),-2) && 'Table'[Date]>= EDATE(TODAY(),-3)),[Value])
)
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
Hi @Velvetine27
>> calculation for past 30 days
I create an example for your reference, please try this,
Measure =
var _header= MAX('Dimension'[Dimension])
return
SWITCH(TRUE(),
_header="M 0 - MTD",SUMX(FILTER('Table','Table'[Date]<=TODAY() && 'Table'[Date]>= EDATE(TODAY(),-1)),[Value]), // -30 day
_header="M -1", SUMX(FILTER('Table','Table'[Date]< EDATE(TODAY(),-1) && 'Table'[Date]>= EDATE(TODAY(),-2)),[Value]),
_header="M -2", SUMX(FILTER('Table','Table'[Date]< EDATE(TODAY(),-2) && 'Table'[Date]>= EDATE(TODAY(),-3)),[Value])
)
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
can you provide more detail about your expected result and paste it as a picture?
hey thanks for your reply. Im looking for something like this. Not sure if this clarifies much, but basically im looking to get this range until M-12.
User | Count |
---|---|
14 | |
8 | |
6 | |
6 | |
5 |
User | Count |
---|---|
23 | |
14 | |
13 | |
8 | |
8 |