Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Friends of the PowerBi community, I have a question: How do I visualize last month's sales on a "smart card"?
I have the following formula but the card shows me the value of the sum of the sales year 2020 and 2021.
Solved! Go to Solution.
Good Morning: Of course with pleasure!
1. Initially I created in my database a column called total sale.
2. I subsequently created a measure called "Sale"
Good Night😉
Try this measure:
Previous Month Sale =
VAR _T =
TODAY ()//or any date
VAR _Y =
YEAR ( _T )
VAR _M =
MONTH ( _T )
VAR _LD =
DATE ( _Y, _M, 1 ) - 1
VAR _FD =
DATE ( _Y, _M - 1, 1 )
RETURN
CALCULATE (
[Sale],
FILTER ( 'Calendar', 'Calendar'[Date] <= _LD && 'Calendar'[Date] >= _FD )
)
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Thank you very much, the formula worked for me, although the novelty I have is that when filtering by month I would be gusaria to show me the sales of the month anteror of the filtering.
In this case I filtered by "Julio", I would be told to bring me the sales of "June".
In the previous code rather than
VAR _T =
TODAY ()
use SELECTEDVALUE.
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Good Morning: Of course with pleasure!
1. Initially I created in my database a column called total sale.
2. I subsequently created a measure called "Sale"
Good Night😉
Try this measure:
Previous Month Sale =
VAR _T =
TODAY ()//or any date
VAR _Y =
YEAR ( _T )
VAR _M =
MONTH ( _T )
VAR _LD =
DATE ( _Y, _M, 1 ) - 1
VAR _FD =
DATE ( _Y, _M - 1, 1 )
RETURN
CALCULATE (
[Sale],
FILTER ( 'Calendar', 'Calendar'[Date] <= _LD && 'Calendar'[Date] >= _FD )
)
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Thank you very much, the formula worked for me, although the novelty I have is that when filtering by month I would be gusaria to show me the sales of the month anteror of the filtering.
In this case I filtered by "Julio", I would be told to bring me the sales of "June".
In the previous code rather than
VAR _T =
TODAY ()
use SELECTEDVALUE.
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
User | Count |
---|---|
140 | |
113 | |
104 | |
76 | |
63 |
User | Count |
---|---|
135 | |
126 | |
110 | |
70 | |
61 |