Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register 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:
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
21 | |
21 | |
19 | |
13 | |
12 |
User | Count |
---|---|
42 | |
28 | |
23 | |
22 | |
22 |