The True/False expression does not specify a column. Each True/False expressions used as a table filter expression must refer to exactly one column

Almasi, Gus 21 Reputation points
2022-09-15T06:57:16.473+00:00

Hi,

I am trying to create a variable to be used as a ledger name . the ledger name, which is the last year Actual ledger ,could be different depending on current financial year. For example if we are in financial year ending to 30/06/2022 the ledger should be 21ACT. or if we are in financial year ending to 30/06/2023 it should be 22ACT. ( our financial year ends to 30th of Jun). Could you please let me know why I am getting the error mentioned in subject line.

Last year Actual ledger =
Var PLDG = If(Month(Today())<=6,
CONCATENATE(
CONVERT(
value(
right(
year(
today()),2)-1),STRING),"ACT"),
CONCATENATE(
right(
year(
today()),2),"ACT"))
Return
CALCULATE(
ALL('Comparing Date'[FY]),
All(dDate[FY]),
All('Comparing Date'[Period]),
All(dDate[Period]),
All('comparing scenario'[Senario]),
All(Scenario[Senario]),
All(Data[Ledger_Name]),
SUM(Data[Amount]),
data[Ledger_Name]=PLDG
)

SQL Server Analysis Services
SQL Server Analysis Services
A Microsoft online analytical data engine used in decision support and business analytics, providing the analytical data for business reports and client applications such as Power BI, Excel, Reporting Services reports, and other data visualization tools.
1,344 questions
{count} votes

Accepted answer
  1. Seeya Xi-MSFT 16,586 Reputation points
    2022-09-16T08:38:14.657+00:00

    Hi @Almasi, Gus ,

    Welcome to Microsoft Q&A!
    In my environment, the results of the run is the same as yours. Of course, I use my own test data.
    Please refer to this document about CALCULATE: https://learn.microsoft.com/en-us/dax/calculate-function-dax
    The is as follows:

    CALCULATE(<expression>[, <filter1> [, <filter2> [, …]]])  
    

    Your ALL() are the filters that should be placed at the back. The SUM() is your expression.
    Thus, here are your new statements:

    Last year Actual ledger =  
    VAR PLDG =  
        IF (  
            MONTH ( TODAY () ) <= 6,  
            CONCATENATE (  
                CONVERT ( VALUE ( RIGHT ( YEAR ( TODAY () ), 2 ) - 1 ), STRING ),  
                "ACT"  
            ),  
            CONCATENATE ( RIGHT ( YEAR ( TODAY () ), 2 ), "ACT" )  
        )  
    RETURN  
        CALCULATE (  
            SUM ( Data[Amount] ),  
            ALL ( 'Comparing Date'[FY] ),  
            ALL ( dDate[FY] ),  
            ALL ( 'Comparing Date'[Period] ),  
            ALL ( dDate[Period] ),  
            ALL ( 'comparing scenario'[Senario] ),  
            ALL ( Scenario[Senario] ),  
            ALL ( Data[Ledger_Name] ),  
            data[Ledger_Name] = PLDG  
        )  
    

    If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data).

    Best regards,
    Seeya


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Alanazi, Tariq Eid 0 Reputation points
    2023-02-15T10:37:38.5666667+00:00

    how to stop the duplicate data on the line

    the data should stop on Apr 2023 why it show end of year so how can i fix that as you see the below

    TarifAlanazi_0-1676365096148.png

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.