Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Creating a column which values are found by other columns

Hello, trying to make report for our invoice approval system. The data report doesn't include the department to which invoice is related, but I have that info seperately and by that I can find information which is the dep. related.

 

Current data set:

 

Invoice NoConfirmerDep
AA1Tom?
AA1John?
AA1Maria?
AA2Jack?
AA2Albert?
AA2David?
BB1Jack?
BB1Maria?
BB1David?

 

Information about the chain of approvers:

DEPConfirmer 1Confirmer 2Confirmer3
SalesTomJohnMaria
FinanceJackAlbertDavid
HRJackMariaDavid

 

End product should look like:

Invoice NoConfirmerDep
AA1TomSales
AA1JohnSales
AA1MariaSales
AA2JackFinance
AA2AlbertFinance
AA2DavidFinance
BB1JackHR
BB1MariaHR
BB1DavidHR

 

I have an idea how this should be done logically, but not technically.

Example:

if AA1 invoice has Tom as a confirmer it must be Sales dep.

If invoice has Jack as first confirmer and the chain also includes Albert it must be related to Finance dep.

And if it has Jack, but has Maria aswell it must be related to HR dep.

1 ACCEPTED SOLUTION

Hi @Anonymous 

Thanks for your reply.

you can try this measure

Measure = 
var _t1= SELECTCOLUMNS( FILTER(ALL('Table'),'Table'[Invoice No]=MIN('Table'[Invoice No])),"name",[Confirmer])
var _sales= VALUES(chain[Sales])
var _hr= VALUES(chain[HR])
var _finance= VALUES(chain[Finance])
return  SWITCH(TRUE(),
COUNTROWS(INTERSECT(_t1,_sales))=3,"sales",
COUNTROWS(INTERSECT(_t1,_hr))=3,"hr",
COUNTROWS(INTERSECT(_t1,_finance))=3,"finance")

vxiaotang_0-1665127083016.png

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-xiaotang
Community Support
Community Support

Hi @Anonymous 

Thanks for reaching out to us.

>> I have an idea how this should be done logically, but not technically.

Do you mean you want to get the expected value without writing code?

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hello, I mean that I kind of know how the logic should be, but when I try to write the code it doesn't work. So just wanted ideas which DAX are the best for case like this and general knowledge input into the problem

Hi @Anonymous 

Thanks for your reply.

you can try this measure

Measure = 
var _t1= SELECTCOLUMNS( FILTER(ALL('Table'),'Table'[Invoice No]=MIN('Table'[Invoice No])),"name",[Confirmer])
var _sales= VALUES(chain[Sales])
var _hr= VALUES(chain[HR])
var _finance= VALUES(chain[Finance])
return  SWITCH(TRUE(),
COUNTROWS(INTERSECT(_t1,_sales))=3,"sales",
COUNTROWS(INTERSECT(_t1,_hr))=3,"hr",
COUNTROWS(INTERSECT(_t1,_finance))=3,"finance")

vxiaotang_0-1665127083016.png

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.