I have 4 columns are A,B,C and D. Those 4 columns are contain number and text or number or text.
If column A&B and C&D are matched then return "Ok" and if column A&B and C&D are not matched then return "No" and if column A&B or C&D are blanks then return "Blanks".
I am achieved my desired result by using duplicate column (A&B , C&D) but I want the same result without duplication columns.
A&B = 'DATA2'[A]&"-"&'DATA2'[B]
C&D = 'DATA2'[C]&"-"&'DATA2'[D]
RESULT = IF(DATA2[A&B]="-","NO",IF(DATA2[C&D]="-","NO", IF(DATA2[A&B] = DATA2[C&D],"OK","NO")))
I am attempted one more DAX for formula but that one also giving error "Cannot convert value 'AA1' of type Text to type Number".
RESULT 1 = CALCULATE(
IF (
SUMX(
'DATA2',
'DATA2'[A]+'DATA2'[B]+'DATA2'[C]+'DATA2'[D])>0,0,1
))
I am looking for New calculated column option.
Any help much appreciated.
Data:
A B C D DESIRED RESULT
AA1 TT1 DD1 XX1 NO
AA1 TT1 DD1 XX1 NO
AA1 TT1 DD1 XX1 NO
AA1 TT1 DD1 XX1 NO
AA1 TT1 DD1 XX1 NO
AA1 TT1 DD1 XX1 NO
AA1 TT2 DD1 XX2 NO
AA1 TT2 DD1 XX2 NO
AA1 TT2 DD1 XX2 NO
AA1 TT2 DD1 XX2 NO
AA1 TT2 DD1 XX2 NO
BB1 RR1 DD1 XX3 NO
BB1 RR1 DD1 XX3 NO
BB1 RR1 DD1 XX3 NO
BB1 RR1 DD1 XX3 NO
BB1 RR2 GG1 HH1 NO
BB1 RR2 GG1 HH2 NO
BB1 RR2 GG1 HH3 NO
NO
NO
NO
NO
BB1 RR2 BB1 RR2 OK
This is how I would solve it:
Result =
var AB = [A]&[B]
var CD = [C]&[D]
return
SWITCH(
TRUE(),
// Blank return if both AB and CD are blank/null
(ISBLANK(AB) || AB = "") && (ISBLANK(CD) || CD = ""), BLANK(),
// A1 return if AB or CD (but not both) are blank
(ISBLANK(AB) || AB = "") || (ISBLANK(CD) || CD = ""), "A1",
// OK return if AB = CD
AB = CD, "OK",
// Catch all remaining cases with NO
"NO"
)
Related
obj_id
Column B
Colunm C
a1
cat
bat
a2
bat
man
r1
man
apple
r2
apple
cat
The orignal dataframe (above) is called df
I am trying to make a new colunm called new_obj_id where if rows in column B match any row of col C the new_obj_id should then have values of obj_id that match col B
obj_id
Column B
Colunm C
new_obj_id
a1
cat
bat
a2
a2
bat
man
r1
r1
man
apple
r2
r2
apple
cat
a1
This is the expected table
This is what I tried but couldn't get through:
dataframe1['new_obj_id'] = dataframe1.apply(lambda x: x['obj_id']
if x['Column_B'] in x['Column C']
else 'none', axis=1)
Try this:
df['new_obj_id'] = df['Column C'].map(dict(zip(df['Column B'],df['obj_id'])))
Output:
0 a2
1 r1
2 r2
3 a1
I have a two tables are Data and Report.
Data
Data table contain the following three columns are Check, Supplier Status and Condition.
Report
Report table contain Supplier Status only.
Result
I am trying to get the count according to the supplier status based on the check (expect “NA”) and condition (=X) only from Data table to Report table.
I am trying to count Ok and Not Ok according to the Supplier status (expect “NA”) with condition =X
Data
Desired Result:
SUPPLIER STATUS NOT OK OK
A1 5 5
A2 4 4
A3 3 3
A4 2 2
A5 1 1
MIXED 1 3
CHECK SUPPLIER STATUS CONDITION
OK A1 X
OK A1 X
OK A1 X
OK A1 X
OK A1 X
NOT OK A1 X
NOT OK A1 X
NOT OK A1 X
NOT OK A1 X
NOT OK A1 X
OK A2 X
OK A2 X
OK A2 X
OK A2 X
NOT OK A2 X
NOT OK A2 X
NOT OK A2 X
NOT OK A2 X
OK A3 X
OK A3 X
OK A3 X
NOT OK A3 X
NOT OK A3 X
NOT OK A3 X
OK A4 X
OK A4 X
NOT OK A4 X
NOT OK A4 X
OK A5 X
NOT OK A5 X
OK MIXED X
OK MIXED X
OK MIXED X
NOT OK MIXED X
OK NA NA
OK NA NA
OK NA NA
NOT OK NA NA
NOT OK NA NA
NOT OK NA NA
I would actually use a measure, not a calculated column. To get a measure filter results like you did in the visual, you need to use the combination of CALCULATE/FILTER functions.
https://learn.microsoft.com/en-us/dax/calculate-function-dax
https://learn.microsoft.com/en-us/dax/filter-function-dax
Count = CALCULATE(COUNTROWS(DATA), FILTER(DATA, DATA[CONDITION] = "X"))
Drop this measure in the values container of the matrix visual.
You can also have a separate measure for counting OK and NOR OK, like:
#Not OK = CALCULATE(COUNTROWS(DATA), FILTER(DATA, DATA[CONDITION] = "X" && DATA[SUPPLIER STATUS] = "NOT OK"))
#OK = CALCULATE(COUNTROWS(DATA), FILTER(DATA, DATA[CONDITION] = "X" && DATA[SUPPLIER STATUS] = "OK"))
In my application, I am trying to load multiple .xpm images.
#include "Images/Destroyed_xpm.h"
//...
QPixmap(Destroyed_xpm).toImage()
When trying to load a 35 * 35 pixels object (above) everything works fine (app compiles, runs. Corretly initialised QImage obj), but when trying to load an image
#include "Images/MainWindowBackGround_xpm.h"
//...
QPixmap(MainWindowBackGround_xpm).toImage()
with 892 * 419 pixels the program produces a huge number of errors during compilation:
3 !3 Ne L9 '3 q9 m~ t= t= o= t= m= o= t= o= o= w9 ;. Oe r= Pe Qe 1~ Re Se Te Ue Ue Ve We Ve Xe Ye Ze `e f .f .f +f #f 23 #f .f $f %f &f *f 53 A9 =f -f ;f >f *f 7 ,f 'f 'f )f !f F:-1: ошибка: ~f {f ]f ^f ). /f :3 Qe (f _f 03 I9 :f <f [f }f [f p~ d3 |f 1f }f q9 2f Ne 3f 4f c3 5f 6f Q9 7f 8f 9f 0f af R9 bf cf df ef ff gf hf if jf kf lf mf nf :} of pf qf F3 rf sf Y] tf uf vf :} wf #0 ,0 %- A| xf yf zf Af Bf ,0 *{ Cf Df Ef Ff Gf Hf If |0 Jf Kf m+ Kf Lf [- Mf Nf Of b< Pf Qf 70 Rf Sf Tf 90 Sf Pf 70 _{ Uf Vf Wf Xf Yf Zf U{ `f g .g +g #g #g $g %g &g *g =g 4{ -g ;g >g ,g 'g )g !g ~g {g ]g ^g /g (g _g :g <g [g }g |g 1g 2g 3g 4g 5g 6g 7g 8g ^{ 9g 0g ag bg cg dg eg fg gg hg ig 8; jg kg lg Kf mg 10 1< mg ng og pg qg rg sg tg ug vg wg xg yg zg ] <[ Ag *g Bg Cg Dg 1; !] Eg W4 Fg Gg Hg Ig Jg Gg O{ Kg Lg Mg Ng Og Pg Qg Rg Sg Tg Y5 Ug Vg R- Wg Xg Yg Zg `g h .h +h #h #h $h %h &h *h =h -h ;h >h ,h 'h )h >9 !h ~h {h ]h ^h /h (h _h :h <h [h Cf }h |h 1h 2h 3h 4h 5h 6h 7h 8h 9h 0h ah bh ch dh eh fh gh hh ih jh kh lh mh nh oh lg ph qh rh sh th uh 6) *b vh wh xh yh zh Ah Bh Ch Dh Eh Fh Gh Hh Ih Jh Kh Lh Mh Nh Oh Ph Qh Rh Sh Th Uh Vh Wh Xh Yh Zh `h i .i +i #i #i $i %i &i *i =i -i ;i >i ,i f} E- 'i )i !i ~i {i ]i ^i /i (i _i :i Kb <i [i }i |i 1i 2i 3i 4i 5i 6i 7i 8i 9i w| m' .6 0i ai xb bi #6 Hc L^ ci di ei M6 X> fi gi Qb hi ii Ub x6 Vb ji ki E6 ^/ =| li *| mi #$ a, c ]/ ;| k( Z6 ni oi F6 // '| F6 )| ^/ {/ F6 pi a/ qi ri si ti ui C# vi wi xi {b yi zi Ai 'c Bi Ci t7 Di B$ Ei Fi e$ D, 6, I, .$ I, k, Gi Hi {$ A( Ii Ji Ki :c Li Mi Ni (_ b& Oi Pi .7 Qi h$ o| Ri Si Ti Ui Vi Wi Xi Yi Zi `i j .j +j #j #j $j %j &j *j =j $8 2i -j ;j >j ,j 'j )j !j ~j {j ]j ^j /j (j _j :j <j [j }j |j 1j 2j 3j 4j 5j [8 6j 7j 8j 9j 0j aj T^ bj cj dj ej fj gj hj h' ij jj kj lj mj nj _, h] oj pj md qj rj sj tj uj vj wj xj +d yj zj Aj `| 0, Bj o( Cj Dj Ej Fj Gj Hj Ij V* z2 Jj Kj Lj Mj Nj Oj Pj Qj Rj Sj Tj Uj Vj Wj Xj Yj Zj `j k .k +k #k #k $k %k &k *k =k -k ;k >k ,k 'k )k !k ~k {k ]k ^k /k (k _k :k <k [k 9# }k F> |k a8 1k =, 2k 3k c' )_ '_ 4k 5k )_ 9/ lj 6k &1 7k 8k 9k 0k ak bk x2 ck dk ek ]> A) ek fk .! Ld +! q8 gk ~2 i_ e_ Od ]2 7_ U) 8_ hk ik jk kk lk mk nk ok lk Vd pk Xd $> qk rk sk tk ]> ]> uk uk vk Gd ,2 wk xk yk zk Ak Bk Ck Ck Dk Ek Fk Gk Hk Ik Ck Jk s_ >e Kk Lk Mk Nk Ok Pk Qk :e Rk Sk Tk Uk Vk Wk Xk Yk .9 Zk `k l .l +l #l #b #b #l $l %l !9 &: &l &: *l =l F2 be -l ;l k* >l H! j* ^9 ,l ]9 M* ]9 'l ve ve J2 y! )l ~d !l 9e v( ~l {l ]l z* ^l T2 /l oe F* (l :9 :9 :9 qe Fj _l :l <l [l E! #: *) D! D! *) }l *) |l 1l K2 %: ",
102850 | " . + # # $ % & & % * = - ; > , ' ) ! ~ { ] ^ / ( _ :-1: ошибка: < [ < } | [ 1 2 2 2 3 4 5 6 7 8 9 0 a b c 5 d e f g h i j f k d l 5 m m n k o n g 2 < 1 1 p q r s t u v 1 w x e y z A A A B C C D E F G H I J H H H K L M N O N P Q R S T U T V W X Y Z ` . l .. +. #. #. $. %. %. &. *. =. -. -. ;. >. ,. '. ). *. !. ~. {. .. ]. ^. /. (. _. :. <. [. }. |. 1. 2. 3. 4. 5. 6. 7. 8. 9. 0. a. b. c. d. e. f. f. g. g. h. i. j. k. j. l. m. n. o. p. q. p. r. s. t. u. v. w. x. y. y. z. A. B. B. C. D. E. F. G. H. I. J. K. L. M. N. O. P. Q. R. S. T. U. V. W. X. Y. Z. `. + .+ ++ #+ #+ $+ %+ &+ *+ =+ *+ -+ ;+ >+ ,+ '+ )+ !+ ~+ {+ ]+ ^+ /+ (+ _+ :+ <+ [+ }+ |+ 1+ 2+ 3+ 4+ 5+ 6+ 7+ 8+ 9+ 0+ a+ b+ c+ d+ e+ f+ g+ h+ i+ j+ k+ l+ m+ n+ o+ p+ q+ r+ s+ t+ u+ v+ w+ x+ y+ z+ A+ B+ C+ D+ E+ F+ G+ H+ I+ J+ K+ L+ ;+ M+ N+ O+ P+ Q+ R+ S+ T+ U+ V+ W+ X+ Y+ Z+ `+ # .# +# ## ## $# %# &# *# =# -# ;# ># ,# '# )# !# ~# {# ]# ^# /# (# _# :# <# [# }# |# 1# 2# 3# 4# 5# 6# 7# 8# 9# 0# a# b# c# d# e# f# g# h# i# j# k# l# m# n# o# p# q# r# s# t# u# v# w# x# y# z# A# B# C# / D# E# F# G# H# I# J# K# L# M# N# O# P# Q# R# S# T# U# V# W# X# Y# Z# `# # .# +# ## ## $# %# &# *# =# -# ;# ># ,# '# )# !# ~# {# ]# ^# /# (# _# :# <# [# }# |# 1# 2# 3# 4# 5# 6# 7# 8# 9# 0# a# b# c# d# d# e# f# g# h# i# j# 8# k# l# m# n# o# p# q# r# s# t# u# v# w# x# y# z# A# B# C# D# E# F# G# H# I# J# K# L# M# N# O# P# Q# R# S# T# U# V# W# X# Y# Z# `# $ .$ +$ #$ #$ $$ %$ &$ *$ =$ -$ ;$ >$ ,$ '$ )$ !$ ~$ ~$ {$ ]$ ^$ /$ ($ _$ :$ <$ [$ }$ |$ 1$ 2$ 3$ 4$ 5$ 6$ ^$ 7$ 8$ 9$ 0$ a$ >$ b$ c$ d$ e$ .$ f$ g$ h$ i$ $ j$ k$ l$ m$ n$ o$ p$ q$ r$ s$ t$ u$ v$ w$ x$ y$ z$ A$ B$ C$ D$ E$ W# F$ G$ H$ I$ J$ K$ L$ M$ N$ O$ P$ Q$ R$ S$ T$ U$ V$ W$ X$ Y$ Z$ `$ % .% U# +% #% #% $% %% &% *% =% -% ;% >% ,% '% )% !% ~% {% ]% x# ^% /% (% _% :% <% [% }% |% 1% 2% 3% 4% 5% 6% 7% 8% 9% 0% a% b% c% d% e% f% g% h% i% j% k% l% m% n% o% p% q% r% k% s% t% u% v% w% x% y% z% A% B% C% D% E% F% G% H% I% J% K% L% M% N% O% P% Q% R% S% T% U% V% W% X% Y% Z% `% & .& +& #& #& $& %& && *& =& -& ;& >& ,& '& )& !& ~& {& ]& ^& /& (& _& :& <& [& }& |& 1& 2& 3& 4& 5& 6& 7& 8& 9& 0& m% a& b& c& d& e& f& g& g& h& i& j& k& l& l& l& m& n& n& o& m& p& q& r& s& t& u& v& w& x& y& z& A& B& C& D& E& F& G& H& I& J& K& L& M& N& O& P& Q& R& S& T& U& V& W& X& Y& Z& `& * .* +* #* #* $* %* &* ** =* +* -* ;* >* ,* '* )* !* '* ~* {* ]* ^* /* (* _* :* <* [* }* |* 1* 2* 3* Q% Q% 4* 5* 6* 7* 8* 9* 0* a* b* c* d* e* f* g* h* 8* i* j* i* k* l* m* n* m* o* p* q* r* q* s* t* u* v* w* x* y* x* y* z* A* B* C* D* E* F* G* H* I* J* i* K* k* k* k* k* L* j* k* M* M* N* ",
102858 | ".3 ze 29 29 we 49 Dr Er &} Fr Gr Hr Ir Jr Kr f9 :-1: ошибка: w #. 93 Lr Mr Je <. &3 Nr Or Pr Qr Rr Sr Tr Or Ur Vr Wr Xr Wr kl Yr nl x~ :. nl L9 Zr `r s .s +s Zr ^f ^f q9 )3 ^f o9 !3 )3 #s )3 )3 L9 #s o= o~ o~ o= B: c3 c3 t= o= $s 73 %s &s *s =s 1f -s ;s >s ,s 's )s !s ~s ~s 's 's {s ]s ]s Ve ^s ^s Ve /s Ve (s xl {s _s 's )s {s ~s :s :s <s J 4= 6= 6= [s }s |s |f rl 1s 2s '3 ;. Ql 3s 03 I9 4s 5s 6s 7s 8s 7s 9s 0s as bs cs ds es J9 J9 fs gs hs X: X: X: is js ks ls ms ns os 0f ps af qs rs ss ts us vs ws xs ys zs As Bs Cs Ds Es Fs Gs Hs Is Js Ks << Cf Ls Sn Ms Ns Os Ps Qs Rs Ss ^0 Ts Us Vs Ws Xs Ys `0 Zs Zs A4 4 4 `s Mf t hm 3[ .t +t #t #t $t #t %t &t *t =t -t 90 ;t >t ,t 't )t Wf Im !t ~t {t ]t ,n ^t h0 5{ /t (t _t :t ,g <t [t }t |t 1t 2t 3t 4t 5t Pm 6t 7t 8t 9t 0t at bt ct dt et ft gt ht it jt kt lt mt nt ot pt qt l; rt st tt ut vt wt xt W5 60 yt C4 zt At Bt Ct Dt Et Ft Gt Ht It Jt Kt Lt Mt Kt Nt Ot Pt Qt Rt St Tt Ut Vt Wt Xt Yt Zt `t 2{ u .u 8{ +u #u 8- #u $u %u &u *u pn =u -u ;u >u ,u 'u )u !u ~u 2- {u ]u ^u /u (u v3 A= _u :u <u [u }u |u 1u 2u 3u 4u 5u 6u 7u 8u 9u 0u au Tf bu cu du eu fu gu hu iu ju ku lu mu nu ou pu ;j qu ru &e su tu Q, uu e$ vu wu xu hu $| yu zu Au F> )7 Bu Cu Du Eu Fu Gu Hu Z* Iu Ju Ku Lu Mu Nu Ou Pu Qu Ru Su Tu Uu Vu Wu Xu Yu Zu `u v .v +v #v #v $v %v &v y1 *v =v }# -v ;v >v ,v 'v )v !v ~v {v ]v ^v {) /v (v _v :v O< <v [v m; }v |v 1v 2v 3v ^i 4v 5v 6v 7v 8v 9v 0v av bv cv *p dv e_ ev fv gv p hv iv jv kv lv s^ -% po mv $p nv E> ov pv qv X> Rb rv sv tv uv vv wv xv yv ~| Gi zv `, Av =| 0, Bv b, 6, c/ .c Cv Dv ~| 5p Ev Fv :q 7) Gv ^c Hv Iv Jv Kv Lv Mv Nv Ov Pv Qv Rv )1 #c Sv nd X, $ Tv Uv 6/ i, m, h, xv h, g, Vv Gi Wv Vb Xv e, Yv n) Zv `v w .w +w #w #w bp $w %w &w *w =w -w ;w >w ,w 'w <e )w !w ~w {w ]w ^w /w (w _w :w <w [w }w |w 1w 2w 3w 4w 5w 6w 7w 8w 9w 0w aw bw cw dw ew ,k [) &u fw gw hw iw jw kw lw mw nw Ic ow pw qw rw sw tw uw , vw 9l ww xw yw zw Aw Bw Cw l, 8k Dw Ew Fw Gw Hw Iw Jw Kw yj Lw Mw J7 Nw Ow Pw Qw Rw Sw Tw Uw Vw Ww Xw -) =l Yw Zw `w x .x +x #x #x $x %x &x Gw *x =x -x ;x >x ,x 'x )x !x ~x {x ]x 07 ^x /x (x _x :x <x [x }x |x 1x 2x 3x 4x 5x 6x 7x 8x 9x 0x ax bx cx !& =, k/ dx ex j% fx Nq 8( _c )( gx hx Ba ix jx kx n) lx 98 .7 mx C# nx C# m% [% ox px qx rx s8 y& [2 sx k& #2 U) tx }2 e_ #! ux vx I& gk P) Qd Jd y& wx Md G& xx yx zx Ax #r Bx Cx Dx Ex Fx Gx Hx Ix Jx Kx Lx ,r ]> n1 G6 Mx n8 Nx Ox Px Qx Rx _r Sx Tx Ux Ux )! (r N_ Vx Wx Xx Yx Q8 Zx `x y .y +y #y #y Qk $y Rk #y %y &y *y =y -y P_ ;y l 32 `k >y ,y r_ 'y )y !y ~y &: {y &l hr ir ]y ^y lr /y (y H! N2 j* ^9 _y ^9 ,l :y <y [y 'l -) }y )9 rr |y rr 1y 2y 3y 4y ]l y* (9 g1 !: P! D* 5y :9 :9 6y 7y 8y 9y 0y ay by v! U7 D! ~9 E! D! E! P2 D! [y -) cy ",
The top three lines of both files in the filesystem
/* XPM */
static char * Destroyed_xpm[] = {
"35 34 2 1",
,
/* XPM */
static char * MainWindowBackGround_xpm[] = {
"892 419 102846 3",
Fs shows: 1.4 kB and 2.9 MB size.
Also, here was noted that
Both are limited to 32767x32767 pixels.
What am I doing wrong?
How do I write the formula for the following:
if B2 = "SF" and D2 = "1"
then H2 = E2 + .75
else if B2 = "SF" and D2 = ".25"
then H2 = E2 + .625
else if B2 = "CW" and D2 = "1"
then H2 = E2 + 1
I want my answers to be in H2, with data being entered into B2, D2 and E2.
=if(AND(B2="SF",D2=1)=TRUE,E2+0.75,if(AND(B2="SF",D2=0.25)=TRUE,E2+0.625,if(AND(B2="CW",D2=1)=TRUE,E2+1,0)))
Regards
I have a basic question on dataframe merge. After I merge two dataframe , is there a way to pick only few columns in the result.
Taking an example from documentation
https://pandas.pydata.org/pandas-docs/stable/merging.html#
left = pd.DataFrame({'key1': ['K0', 'K0', 'K1', 'K2'],
'key2': ['K0', 'K1', 'K0', 'K1'],
'A': ['A0', 'A1', 'A2', 'A3'],
'B': ['B0', 'B1', 'B2', 'B3']})
right = pd.DataFrame({'key1': ['K0', 'K1', 'K1', 'K2'],
'key2': ['K0', 'K0', 'K0', 'K0'],
'C': ['C0', 'C1', 'C2', 'C3'],
'D': ['D0', 'D1', 'D2', 'D3']})
result = pd.merge(left, right, on=['key1', 'key2'])
Result comes as :
A B key1 key2 C D
0 A0 B0 K0 K0 C0 D0
1 A2 B2 K1 K0 C1 D1
2 A2 B2 K1 K0 C2 D2
None
Is there a way I can chose only column 'C' from 'right' dataframe? For example, I would like my result to be like:
A B key1 key2 C
0 A0 B0 K0 K0 C0
1 A2 B2 K1 K0 C1
2 A2 B2 K1 K0 C2
None
result = pd.merge(left, right[['key1','key2','C']], on=['key1', 'key2'])
OR
right.merge(left, on=['key1','key2'])[['A','B','C','key1','key2']]