Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anilb1603
Contributor III
Contributor III

QS Table showing duplicate records when using if condition in expressions (measures)

Hi Guys,

I have the sample data like below:

ProjectDateTypeStatusBudgetActuals
P11/20/2020HistorySubmitted100,00098,000
P11/30/2020HistoryIn Progress100,00098,000
P12/21/2020CurrentCompleted100,00098,000
P21/20/2020HistorySubmitted100,00098,000
P21/30/2020HistoryIn Progress100,00098,000
P22/21/2020CurrentCompleted100,00098,000

 

for this I created a adhoc report with 3 dimensions (Fieldname: Pick_Dims) and 2 measures (Fieldname: Pick Metrics).

When I select either Project or Status, I want to show the current status only  for each project and when I select the Date, I want to show the full history of a project (show the project status by date). 

So I created the expression like below:

If(SubStringCount(Concat(Pick_Dims, '|'), 'Date')=1,
     Sum(Budget),
      Sum({<Type={'Current'}>} Budget)

     )

But here, when I select Project and Status, I am seeing the duplicate records. I don't want to use suppress 0 values option as I might have some valid 0 budget records in the data  model. If I use just Sum({<Type={'Current'}>} Budget), It showing only one record. I assume that If condition causing the duplication.

Can someone please help me here.

Thanks,

Anil

1 Reply
Anilb1603
Contributor III
Contributor III
Author

Did anyone get a chance to look at this one??