The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi, I want the DAX Column measure formula to calculate the last 6-month change based on the product category. if the last 6 months data isn't available it should be displayed as blank not 0 or error. This is a table example for the output of the problem I am having. TIA
Product Category | Date | NormalRate | ChangeLastMonth | ChangeLast6Months |
Bike | Feb-22 | 100 | ||
Bike | Mar-22 | 95 | -5 | |
Bike | Apr-22 | 54.51 | -40.49 | |
Bike | May-22 | 85.22 | 30.71 | |
Bike | Jun-22 | 99.88 | 14.66 | |
Bike | Jul-22 | 100 | 0.12 | |
Bike | Aug-22 | 100 | 0 | 0 |
Bike | Sep-22 | 100 | 0 | 5 |
Bike | Oct-22 | 100 | 0 | 45.49 |
Bike | Nov-22 | 100 | 0 | 14.78 |
Bike | Dec-22 | 100 | 0 | 0.12 |
Bike | Jan-23 | 100 | 0 | 0 |
Bike | Feb-23 | 97 | -3 | -3 |
Bike | Mar-23 | 98 | 1 | -2 |
Bike | Apr-23 | 95 | -3 | -5 |
Shoes | Aug-22 | 100 | ||
Shoes | Sep-22 | 100 | 0 | |
Shoes | Oct-22 | 100 | 0 | |
Shoes | Nov-22 | 90 | -10 | |
Shoes | Dec-22 | 80 | -10 | |
Shoes | Jan-23 | 70 | -10 | |
Shoes | Feb-23 | 60 | -10 | -40 |
Shoes | Mar-23 | 50 | -10 | -50 |
Shoes | Apr-23 | 40 | -10 | -60 |
Clothes | Jun-22 | 25 | ||
Clothes | Jul-22 | 35 | 10 | |
Clothes | Aug-22 | 45 | 10 | |
Clothes | Sep-22 | 55 | 10 | |
Clothes | Oct-22 | 65 | 10 | |
Clothes | Nov-22 | 75 | 10 | |
Clothes | Dec-22 | 85 | 10 | 60 |
Clothes | Jan-23 | 95 | 10 | 60 |
Clothes | Feb-23 | 100 | 5 | 55 |
Clothes | Mar-23 | 94 | -6 | 39 |
Clothes | Apr-23 | 95 | 1 | 30 |
Clothes | May-23 | 91 | -4 | 16 |
Solved! Go to Solution.
hi @adni85
try like:
Column =
VAR _rate =
MAXX(
FILTER(
data,
data[Product Category]=EARLIER(data[Product Category])
&&data[Date]=EDATE(EARLIER([Date]), -6)
),
data[NormalRate]
)
VAR Result =
IF(
ISBLANK(_rate),
BLANK(),
[NormalRate] - _rate
)
RETURN Result
it worked like:
hi @adni85
try like:
Column =
VAR _rate =
MAXX(
FILTER(
data,
data[Product Category]=EARLIER(data[Product Category])
&&data[Date]=EDATE(EARLIER([Date]), -6)
),
data[NormalRate]
)
VAR Result =
IF(
ISBLANK(_rate),
BLANK(),
[NormalRate] - _rate
)
RETURN Result
it worked like:
User | Count |
---|---|
28 | |
12 | |
8 | |
7 | |
5 |
User | Count |
---|---|
36 | |
14 | |
12 | |
7 | |
7 |