March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi @DanielPontes ,
Here's the solution.
Sample data:
1.Create a table for two value types by entering data:
2.Create threes measures for different periods.
1 months =
var _start=EOMONTH(MAX('Table'[Data]),-1)
var _end=EOMONTH(MAX('Table'[Data]),0)
var _aptos=CALCULATE(SUM('Table'[Valor Aptos]),FILTER('Table',[Data]>_start&&[Data]<=_end))
var _casas=CALCULATE(SUM('Table'[Valor Casas]),FILTER('Table',[Data]>_start&&[Data]<=_end))
return SWITCH(MAX('Table (2)'[Type]),"Valor Aptos",_aptos,"Valor Casas",_casas)
6 months =
var _start=EOMONTH(MAX('Table'[Data]),-6)
var _end=EOMONTH(MAX('Table'[Data]),0)
var _aptos=CALCULATE(SUM('Table'[Valor Aptos]),FILTER('Table',[Data]>_start&&[Data]<=_end))
var _casas=CALCULATE(SUM('Table'[Valor Casas]),FILTER('Table',[Data]>_start&&[Data]<=_end))
return SWITCH(MAX('Table (2)'[Type]),"Valor Aptos",_aptos,"Valor Casas",_casas)
12 months =
var _start=EOMONTH(MAX('Table'[Data]),-12)
var _end=EOMONTH(MAX('Table'[Data]),0)
var _aptos=CALCULATE(SUM('Table'[Valor Aptos]),FILTER('Table',[Data]>_start&&[Data]<=_end))
var _casas=CALCULATE(SUM('Table'[Valor Casas]),FILTER('Table',[Data]>_start&&[Data]<=_end))
return SWITCH(MAX('Table (2)'[Type]),"Valor Aptos",_aptos,"Valor Casas",_casas)
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @DanielPontes ,
Here's the solution.
Sample data:
1.Create a table for two value types by entering data:
2.Create threes measures for different periods.
1 months =
var _start=EOMONTH(MAX('Table'[Data]),-1)
var _end=EOMONTH(MAX('Table'[Data]),0)
var _aptos=CALCULATE(SUM('Table'[Valor Aptos]),FILTER('Table',[Data]>_start&&[Data]<=_end))
var _casas=CALCULATE(SUM('Table'[Valor Casas]),FILTER('Table',[Data]>_start&&[Data]<=_end))
return SWITCH(MAX('Table (2)'[Type]),"Valor Aptos",_aptos,"Valor Casas",_casas)
6 months =
var _start=EOMONTH(MAX('Table'[Data]),-6)
var _end=EOMONTH(MAX('Table'[Data]),0)
var _aptos=CALCULATE(SUM('Table'[Valor Aptos]),FILTER('Table',[Data]>_start&&[Data]<=_end))
var _casas=CALCULATE(SUM('Table'[Valor Casas]),FILTER('Table',[Data]>_start&&[Data]<=_end))
return SWITCH(MAX('Table (2)'[Type]),"Valor Aptos",_aptos,"Valor Casas",_casas)
12 months =
var _start=EOMONTH(MAX('Table'[Data]),-12)
var _end=EOMONTH(MAX('Table'[Data]),0)
var _aptos=CALCULATE(SUM('Table'[Valor Aptos]),FILTER('Table',[Data]>_start&&[Data]<=_end))
var _casas=CALCULATE(SUM('Table'[Valor Casas]),FILTER('Table',[Data]>_start&&[Data]<=_end))
return SWITCH(MAX('Table (2)'[Type]),"Valor Aptos",_aptos,"Valor Casas",_casas)
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello @DanielPontes , to calculate one month, 6 months and 12 months we need a date from which it has to calculate like that once that is available then using 'ADDCOLUMNS' DAX you can achieve this I believe.
So please decide a date from which these filters need to be calculated and then create your new table.
If this post helps, then please consider accepting it as the solution to help other members find it more quickly. Thank You!!
Hello @Kishore_KVN
Your idea works if i had one date, bat I have "Valor Casa" anda Valor Aptos". I try use ADDCOLUMNS and CALCULATE, but it's not possible add more than one line, and I need one for each time that I need comparate ("1month", "2month", "3 month"). Like this:
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
21 | |
14 | |
11 | |
8 | |
5 |
User | Count |
---|---|
28 | |
21 | |
20 | |
13 | |
10 |