Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Newbie777
Partner - Creator III
Partner - Creator III

Count the number of vendors which had transactions in selected years

Hi,

I'd like to write a measure formula which only counts the number of vendors which the company had transactions in a selected years and not count all the vendors in the vendor master data.  The formula below is producing error message. 

 

=count(if(aggr(
sum({<[Year]={$(=max([Year]))} >} [Amount in local currency]),[Vendor name]))<>0
,distinct([Vendor name]),0))

 

I'd appreciate it if you could let me know how I can fix the formula.  

 

Thank you!

2 Solutions

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Count({<[Vendor Name] = {"=Sum({<[Year]={$(=max([Year]))>}[Amount in local currency]) > 0"}>} Distinct [Vendor Name])

-Rob

View solution in original post

Kushal_Chawda

@Newbie777  you have syntax error in your expression. You are missing "}"  as highlighted below

Count({<[Vendor Name] = {"=Sum({<[Year]={$(=max([Year]))}>}[Amount in local currency]) > 0"}>} Distinct [Vendor Name])

View solution in original post

5 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Count({<[Vendor Name] = {"=Sum({<[Year]={$(=max([Year]))>}[Amount in local currency]) > 0"}>} Distinct [Vendor Name])

-Rob

Newbie777
Partner - Creator III
Partner - Creator III
Author

Thanks a lot for your advice.  I copied and pasted your measure formula into the app, and the answer yielded is 0, even though vendor name count should be a different number.  I am going in the right direction, but I am wondering what is wrong still.  

Newbie7_0-1631371779890.png

 

Kushal_Chawda

@Newbie777  you have syntax error in your expression. You are missing "}"  as highlighted below

Count({<[Vendor Name] = {"=Sum({<[Year]={$(=max([Year]))}>}[Amount in local currency]) > 0"}>} Distinct [Vendor Name])

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Can you replicate this by hand? Meaning make a chart with dimension = [Name 2] and Measure = Sum([FBL3N by employee.Amount in local currency]. Then select Year=2021 in selections.  

-Rob

Newbie777
Partner - Creator III
Partner - Creator III
Author

Excellent.  I added the curly bracket missing and the formula works now.  Thanks a lot!