Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hi everyone. I am a fresher in Power BI. Please help to look at 2 pictures below.
- Week wash is a column
- Rank is a column that was created by week wash and month
- Distinctcustomerbycategory is a measure. It will count the number of days of each week except Sunday.
With the first picture below. I want to have a condition, If Distinctcustomerbycategory <=2, It will always plus for the next row with Rank = 2. After the value of Distinctcustomerbycategory will return Blank. If It doesn't have any value <= 2. Keep staying all value
The result I want.
Week wash Rank Distinctcustomerbycategory
March 2 1 Blank
March 9 2 8 (2+6)
March 16 3 6
March 23 4 6
March 30 5 6
With the seconde picture below. If Distinctcustomerbycategory <=2. It will always plus for the next row with Rank = 1 of next month ( first week of May month). After plus the value of Distinctcustomerbycategory will return Blank. If It doesn't have any value <= 2. Keep stay all value.
Week wash Rank Distinctcustomerbycategory
April 6 1 6
April 13 2 6
April 20 3 5
April 27 4 5
April 30 5 Blank
May 5 1 6 (2+4)
Thanks for helping
Solved! Go to Solution.
Hi @tranguyen ,
Try below:
_Value = MAX('Table'[Value])
Measure = var _v = [_Value]
var _pre = ADDCOLUMNS('Table',"pre",SUMX(FILTER(ALL('Table'),[Rank]=EARLIER('Table'[Rank])-1),[_Value]))
RETURN IF(_v<=2,"blank",IF(SUMX(_pre,[pre])<=2,_v+SUMX(_pre,[pre]),_v))
Hope it helps!
Best regards,
Community Support Team_ Scott Chang
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Hi @tranguyen ,
I made simple samples and you can check the results below:
Measure = var _v = MAX('Table'[Value])
var _pre = ADDCOLUMNS('Table',"pre",SUMX(FILTER(ALL('Table'),[Rank]=EARLIER('Table'[Rank])-1),[Value]))
RETURN IF(_v<=2,"blank",IF(SUMX(_pre,[pre])<=2,_v+SUMX(_pre,[pre]),_v))
An attachment for your reference. Hope it helps!
Best regards,
Community Support Team_ Scott Chang
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for helping. But Value in this case is a measure, When I used max([Value]) It showed:
- The MAX function only accepts a column reference as the argument number 1.
Hi @tranguyen ,
Try below:
_Value = MAX('Table'[Value])
Measure = var _v = [_Value]
var _pre = ADDCOLUMNS('Table',"pre",SUMX(FILTER(ALL('Table'),[Rank]=EARLIER('Table'[Rank])-1),[_Value]))
RETURN IF(_v<=2,"blank",IF(SUMX(_pre,[pre])<=2,_v+SUMX(_pre,[pre]),_v))
Hope it helps!
Best regards,
Community Support Team_ Scott Chang
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
@tranguyen , use new table levels calculation , previous should help in this case
🚀 Power BI Update: Visual calculations (preview)🚀
https://powerbi.microsoft.com/en-us/blog/visual-calculations-preview/
After updating a new Power BI. What should I do now to solve my problems?
Do you have any way to solve this besides updating visual calculations or this is the only way to solve it?