Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Dear all,
I am seeking for a help on subject below, still new on power bi desktop , your help will be greatly appreciated 🙇🏻
May I ask How can I add conditional icons with the comparison of value in previous column? Is it even possible?
(will measure able to do custom % percentage changes comparison ? am new to measure things, kindly can anyone point me a direction ,please?)
In my case I have a martix like this (attached picture )
Row is item id
Column 0-10 is actually every minute of a data update( dax Function seems only have previous month or year, so am getting lost of direction)
What I wonder how can I conditionally add icons like ⬇️➡️⬆️
When item id compare with previous column value(last min of update)
ie item id 2 , between each minute , for example 0 to 1, then 1 to 2 (so far and so on)
has 30% drop mark as ⬇️
less or equal to 3% mark as ➡️
has 30% or above increase mark as ⬆️
I had looked at this old post https://community.powerbi.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-basede-on-previous-val...
which is similar (he can use previousmonth function and only detect value changes but not in %)
Any suggestions will be greatly help, Thanks in advance 🙏🏻🙇🏻
Solved! Go to Solution.
Hi, @hkbs ;
Please try it:
Measure =
VAR _a =
CALCULATE (
SUM ([sold] ),
FILTER (ALLSELECTED('Table'),[itemld]=MAX([itemld])&& [timestamp] = MAX ( [timestamp] ) - 1))
VAR _b =DIVIDE ( SUM([sold]) - _a, _a )
RETURN
SWITCH (
TRUE (),
MAX ( [timestamp] ) = 0, BLANK (),
_b < -0.3, -1,
_b <= 0.03, 0,
_b >= 0.3, 1 )
The final output is shown below:
Please correct me if it is incorrect and I am looking forward to your reply。
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @hkbs ;
According to my understand, you could create a measure in matrix, another measure as conditional formatting.
value2 = SUM([value])*MAX('slicer'[discount])
Measure =
VAR _a =
CALCULATE (
SUM ( [value] )*MAX('slicer'[discount]),
FILTER (ALLEXCEPT ( 'Table', 'Table'[Item_id] ), [Column1] = MAX ( [Column1] ) - 1))
VAR _b =DIVIDE ( CALCULATE ( SUM ( [value] )*MAX('slicer'[discount]) ) - _a, _a )
RETURN
SWITCH (
TRUE (),
MAX ( [Column1] ) = 0, BLANK (),
_b < -0.3, -1,
_b <= 0.03, 0,
_b >= 0.3, 1 )
The final output is shown below:
If I don't understand correctly, please share more information about your table data and what you want to output.
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @hkbs ;
You could try to create a measure.
Measure =
VAR _a =
CALCULATE (
SUM ( [value] ),
FILTER (ALLEXCEPT ( 'Table', 'Table'[Item_id] ), [Column1] = MAX ( [Column1] ) - 1))
VAR _b =DIVIDE ( CALCULATE ( SUM ( [value] ) ) - _a, _a )
RETURN
SWITCH (
TRUE (),
MAX ( [Column1] ) = 0, BLANK (),
_b < -0.3, -1,
_b <= 0.03, 0,
_b >= 0.3, 1 )
Then set conditional formatting.
The final output is shown below:
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
thanks for the reply
the images u shown above is exact result of how i hoping icons being display.
however i can't repliate the result of your value 2 mesaure's code, because my case is not exactly the same.
i understand your logic in the code is that u think i want to apply and compute the discount on to each of the field value then runs the compare of columns and fill the conditional icons.
but in my martrix , pick item 2 with column 0 as example the field 17119 is actually a combine total of item2 vaule @ certain discount rate sold
here is a dummy example how the data in my source table it is :
item Id sold discount timestamp
2 10000 78 0
2 7000 78 0
2 55 88 0
2 55 88 0
2 6 98 0
2 3 98 0
2 10000 78 1
2 7000 78 1
2 55 88 1
2 55 88 1
2 6 98 1
2 3 98 1
2 9000 78 2
2 6000 88 2
2 700 88 2
2 20 88 2
2 5 98 2
that's how my data came in from my source.
what i am hoping is when I click say discount rate 78 in my slicer
the martix then shows the sold value with discount 78(the total then is 17000) and the next colum will compare with it so i can see the trend increase or decrease under that discount rate. (conditional icons according to the % changes)
does that make any sences to u?
many many thanks for your time.
Hi, @hkbs ;
Please try it:
Measure =
VAR _a =
CALCULATE (
SUM ([sold] ),
FILTER (ALLSELECTED('Table'),[itemld]=MAX([itemld])&& [timestamp] = MAX ( [timestamp] ) - 1))
VAR _b =DIVIDE ( SUM([sold]) - _a, _a )
RETURN
SWITCH (
TRUE (),
MAX ( [timestamp] ) = 0, BLANK (),
_b < -0.3, -1,
_b <= 0.03, 0,
_b >= 0.3, 1 )
The final output is shown below:
Please correct me if it is incorrect and I am looking forward to your reply。
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
hi thanks for all the help
may i ask if i have an other table which is 2 level of matrix
ie
customer id
A01 0 1 2 3 so far and so on-- timestamp
-(click to expend to item id)
1 value value value value
2 value value value value
3 value value value value
A02
-(click to expend to item id)
1 value value value value
2 value value value value
3 value value value value
so far and so on
how can i apply the same logic to that?
you help will be greatly appeciated thanks in advance
thanks for all the helps along the way i learnt a lots !
when u have time can u point me a way on a samiliar way with a 2 level martix that i want to do the same logic on that? (logic to apply on item id level)
martix will look like
CustomerID 0 1 2 3 4
A01
(click ,expand to item id)
2 value value value value value
3 value value value value value
A02
(click ,expand to item id)
1 value value value value value
2 value value value value value
ie the data will comes in like this
CustomerID itemID sold discount timestamp
A01 1 10000 78 0
A01 1 7000 78 0
A01 1 55 88 0
A01 1 55 88 0
A01 1 6 98 0
A01 1 3 98 0
A01 1 10000 78 1
A01 1 7000 78 1
A01 1 55 88 1
A01 1 55 88 1
A01 1 6 98 1
A01 1 3 98 1
A01 1 9000 78 2
A01 1 6000 88 2
A01 1 700 88 2
A01 1 20 88 2
A01 1 5 98 2
A01 2 10000 78 0
A01 2 7000 78 0
A01 2 55 88 0
A01 2 55 88 0
A01 2 6 98 0
A01 2 3 98 0
A01 2 10000 78 1
A01 2 7000 78 1
A01 2 55 88 1
A01 2 55 88 1
A01 2 6 98 1
A01 2 3 98 1
A01 2 9000 78 2
A01 2 6000 88 2
A01 2 700 88 2
A01 2 20 88 2
A01 2 5 98 2
A02 2 10000 78 0
A02 2 7000 78 0
A02 2 55 88 0
A02 2 55 88 0
A02 2 6 98 0
A02 2 3 98 0
A02 2 10000 78 1
A02 2 7000 78 1
A02 2 55 88 1
A02 2 55 88 1
A02 2 6 98 1
A02 2 3 98 1
A02 2 9000 78 2
A02 2 6000 88 2
A02 2 700 88 2
A02 2 20 88 2
A02 2 5 98 2
A02 3 10000 78 0
A02 3 7000 78 0
A02 3 55 88 0
A02 3 55 88 0
A02 3 6 98 0
A02 3 3 98 0
A02 3 10000 78 1
A02 3 7000 78 1
A02 3 55 88 1
A02 3 55 88 1
A02 3 6 98 1
A02 3 3 98 1
A02 3 9000 78 2
A02 3 6000 88 2
A02 3 700 88 2
A02 3 20 88 2
A02 3 5 98 2
is this page funtion should be what i should try ?
Thanks so much !
this works on sum very well, just I forgotten to mention my total has a slicer that will allow me to show different total under certain discount (the slicer apply discount range of the itemid , ie the discount of 78,88,98) the sum in my previous image show total of those combined .
Is that possible that when I click the slicer 78
then this measure still applies following with the same logic but not only just the total sum(across 78,88,98) like your provided method?
Again many many thanks for your time on replying me , it greatly helped me thanks soooo much
You can do that by using your existing data range or adding a measure that indicates the desired graphic, and then using conditional formatting
User | Count |
---|---|
76 | |
75 | |
46 | |
31 | |
27 |
User | Count |
---|---|
99 | |
91 | |
51 | |
49 | |
45 |