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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
RogueTrooper
Regular Visitor

How to create second filter

Hi.

I have an issue with adding a second filter to my formula.

 

Before I added the second filter, the formula was error free.

 

ALL OS VALUE PERIOD = CALCULATE(SUM(MNSalesOrderLine[OS LCY Value]),USERELATIONSHIP(MNSalesOrderHdr[No],MNSalesOrderLine[Document_No]),filter(MNSalesOrderLine,MNSalesOrderLine[Shipment_Date] <=EOMONTH(MAX(LastRefreshedDate[DateLastRefreshed]),0) && MNSalesOrderHdr[Status] = "RELEASED"))
 
There are three entries within the 'status' field, hence my requirement to select 'RELEASED'.
 
Error reported, "A single value for column "Status" in table MNSalesOrderHdr cannot be determined.
 
Any thoughts?
 
Regards
 
Wayne
1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @RogueTrooper ,

According to your description, in your formula, in the FILTER function, you can only directly reference columns in the current table or other measures. When you enter a single quote, it automatically pops up which can only be quoted like below:

vkalyjmsft_0-1659000238545.png

I create a sample.

MNSalesOrderLine table:

vkalyjmsft_1-1659000383413.png

MNSalesOrderHdr table:

vkalyjmsft_2-1659000428569.png

LastRefreshedDate table:

vkalyjmsft_3-1659000444716.png

Modify the measure like this:

ALL OS VALUE PERIOD =
CALCULATE (
    SUM ( MNSalesOrderLine[OS LCY Value] ),
    USERELATIONSHIP ( MNSalesOrderHdr[No], MNSalesOrderLine[Document_No] ),
    FILTER (
        MNSalesOrderLine,
        MNSalesOrderLine[Shipment_Date]
            <= EOMONTH ( MAX ( LastRefreshedDate[DateLastRefreshed] ), 0 )
            && MAXX (
                FILTER (
                    'MNSalesOrderHdr',
                    'MNSalesOrderHdr'[No] = EARLIER ( 'MNSalesOrderLine'[Document_No] )
                ),
                'MNSalesOrderHdr'[Status]
            ) = "RELEASED"
    )
)

 Get the correct result.

vkalyjmsft_4-1659000531770.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

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

View solution in original post

2 REPLIES 2
v-yanjiang-msft
Community Support
Community Support

Hi @RogueTrooper ,

According to your description, in your formula, in the FILTER function, you can only directly reference columns in the current table or other measures. When you enter a single quote, it automatically pops up which can only be quoted like below:

vkalyjmsft_0-1659000238545.png

I create a sample.

MNSalesOrderLine table:

vkalyjmsft_1-1659000383413.png

MNSalesOrderHdr table:

vkalyjmsft_2-1659000428569.png

LastRefreshedDate table:

vkalyjmsft_3-1659000444716.png

Modify the measure like this:

ALL OS VALUE PERIOD =
CALCULATE (
    SUM ( MNSalesOrderLine[OS LCY Value] ),
    USERELATIONSHIP ( MNSalesOrderHdr[No], MNSalesOrderLine[Document_No] ),
    FILTER (
        MNSalesOrderLine,
        MNSalesOrderLine[Shipment_Date]
            <= EOMONTH ( MAX ( LastRefreshedDate[DateLastRefreshed] ), 0 )
            && MAXX (
                FILTER (
                    'MNSalesOrderHdr',
                    'MNSalesOrderHdr'[No] = EARLIER ( 'MNSalesOrderLine'[Document_No] )
                ),
                'MNSalesOrderHdr'[Status]
            ) = "RELEASED"
    )
)

 Get the correct result.

vkalyjmsft_4-1659000531770.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

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

vapid128
Solution Specialist
Solution Specialist

ALL OS VALUE PERIOD =
CALCULATE(
SUM(MNSalesOrderLine[OS LCY Value]),
USERELATIONSHIP(
MNSalesOrderHdr[No],
MNSalesOrderLine[Document_No]
),
filter(
MNSalesOrderLine,
MNSalesOrderLine[Shipment_Date] <=EOMONTH(MAX(LastRefreshedDate[DateLastRefreshed]),0) && MNSalesOrderHdr[Status] = "RELEASED"
)
)

 

that table name is incorrect.

 

Do you mean:

ALL OS VALUE PERIOD =
If(
MNSalesOrderHdr[Status] = "RELEASED",
CALCULATE(
SUM(MNSalesOrderLine[OS LCY Value]),
USERELATIONSHIP(
MNSalesOrderHdr[No],
MNSalesOrderLine[Document_No]
),
filter(
MNSalesOrderLine,
MNSalesOrderLine[Shipment_Date] <=EOMONTH(MAX(LastRefreshedDate[DateLastRefreshed]),0)
)
),
blank()
)

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.