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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Lamarandteddy
New Member

Multiple Columns Error

Hello all,

 

I am trying to show an output of all of the months that have a budget value of more than $444000 in 2023. However, I keep getting the error "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value." Can someone please assist?

 

Here is my code:

 

AggregatedBudgetMonthsOver440K =
GROUPBY(
        FILTER(
            'FP&A Metrics',
            YEAR('FP&A Metrics'[Month]) = 2023 &&
            'FP&A Metrics'[Exercise Type] = "Budget"
        ),
        'FP&A Metrics'[Month],
        "TotalValue", SUMX(CURRENTGROUP(), 'FP&A Metrics'[Value]> 444000)
    )
1 ACCEPTED SOLUTION
v-huijiey-msft
Community Support
Community Support

Hi @Lamarandteddy ,

 

Thanks for the reply from @lbendlin  @Ashish_Mathur , please allow me to provide another insight.

 

Please try:

BudgetValuesOver100K = 
FILTER(
    SUMMARIZE(
        FILTER(
            'FP&A Metrics'.
            'FP&A Metrics'[Exercise Type] = "Budget"
        ),
        'FP&A Metrics'[Month].
        "TotalValue", SUM('FP&A Metrics'[Value])
    ),
[TotalValue] > 10000
)

 

This is the original data table:

vhuijieymsft_0-1711100575075.png

 

This is the data table created by New Table, showing data for months where [TotalValue] > 10000.

vhuijieymsft_1-1711100589700.png

 

The data you provided has only one month and the Month type is not Date, please note this in your original data table.

 

Please change [TotalValue] > 10000 to [TotalValue] > 444000.

 

The pbix file is attached.

 

If you have any other questions please feel free to contact me.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

View solution in original post

15 REPLIES 15
v-huijiey-msft
Community Support
Community Support

Hi @Lamarandteddy ,

 

Thanks for the reply from @lbendlin  @Ashish_Mathur , please allow me to provide another insight.

 

Please try:

BudgetValuesOver100K = 
FILTER(
    SUMMARIZE(
        FILTER(
            'FP&A Metrics'.
            'FP&A Metrics'[Exercise Type] = "Budget"
        ),
        'FP&A Metrics'[Month].
        "TotalValue", SUM('FP&A Metrics'[Value])
    ),
[TotalValue] > 10000
)

 

This is the original data table:

vhuijieymsft_0-1711100575075.png

 

This is the data table created by New Table, showing data for months where [TotalValue] > 10000.

vhuijieymsft_1-1711100589700.png

 

The data you provided has only one month and the Month type is not Date, please note this in your original data table.

 

Please change [TotalValue] > 10000 to [TotalValue] > 444000.

 

The pbix file is attached.

 

If you have any other questions please feel free to contact me.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

lbendlin
Super User
Super User

I am trying to show an output of all of the months that have a budget value of more than $444000 in 2023.

How are you planning to show that?  Measures can only return scalar values.  You would have to use your result as a filter inside a measure.

Ashish_Mathur
Super User
Super User

Hi,

Share some data to work with and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

I am trying to do perform a tabular funtion, not a scalar function Attached is what I am trying to succesfully perform. The other attached is what I get based on the error I listed.Screenshot 2024-03-09 194445.pngScreenshot 2024-03-09.png

There is no such thing as a tabular function in DAX.  Your only option would be a calculated table but that is immutable.

 

Table variables can be used inside a measure but the result must be a scalar.

Ok, so how would I give an expression which returns all months in 2023 that have a budget value greater than $440K in aggregate form? 

Create your visual with all months in 2023 and their value.

 

In your measure,

Use what you created (personally I would use SUMMARIZE, but that's a matter of preference)  and then test if the SELECTEDVALUE month is part of that list.  If yes, return 1, otherwise return 0.

Lastly, use your measure as a filter for the visual.

 

Or - use the filter pane to show only months above the budget value threshold...

Could you give me all of the aggregate function so I can make sure the output performs correctly? 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

BuildingBusiness AreaAccount_KeyAccountExercise TypeMonthValue
Office Building 4CorporateAccount_Generator MaintenanceGenerator MaintenanceBudget1-Jan-22$0

Here is my expected output Screenshot 2024-03-09 205511.png

I only see one row of data with a 0 value?

Here is another one:

 

BuildingBusiness AreaAccount_KeyAccountExercise TypeMonthValue
Office Building 4CorporateAccount_Furniture/Cubicle RefurbishFurniture/Cubicle RefurbishForecast1-Feb-23$0
Office Building 4CorporateAccount_Parking Lot MaintenanceParking Lot MaintenanceForecast1-Feb-23$0
Office Building 4CorporateAccount_Plumbing WorkPlumbing WorkForecast1-Feb-23$0
Office Building 4CorporateAccount_Multimedia AV RepairsMultimedia AV RepairsForecast1-Feb-23$0
Office Building 4CorporateAccount_Light Bulbs/Electrical Supp.Light Bulbs/Electrical Supp.Forecast1-Feb-23$0
Office Building 4CorporateAccount_Other General SuppliesOther General SuppliesForecast1-Feb-23$0
Office Building 4CorporateAccount_Ergonomic PurchasesErgonomic PurchasesForecast1-Feb-23$0
Office Building 4CorporateAccount_Contract Food/Beverage/VendingContract Food/Beverage/VendingForecast1-Feb-23$0
Office Building 4CorporateAccount_Courier & Freight ServicesCourier & Freight ServicesForecast1-Feb-23$0
Office Building 4CorporateAccount_Water/SewerWater/SewerForecast1-Feb-23$0
Office Building 4CorporateAccount_Waste ManagementWaste ManagementForecast1-Feb-23$120
Office Building 4CorporateAccount_IT Outside Services & ContractsIT Outside Services & ContractsForecast1-Feb-23$1,582
Office Building 4CorporateAccount_Affiliate ContractsAffiliate ContractsForecast1-Feb-23($633)
Office Building 4CorporateAccount_Tenant LeasesTenant LeasesForecast1-Feb-23($6,682)
Office Building 4CorporateAccount_Building RentBuilding RentForecast1-Feb-23$168,750
Office Building 4CorporateAccount_CAMCAMForecast1-Feb-23$8,438
Office Building 4CorporateAccount_Property Tax for Owned Real PropertyProperty Tax for Owned Real PropertyForecast1-Feb-23$13,590
Office Building 4CorporateAccount_Property Tax For Leased FacilitiesProperty Tax For Leased FacilitiesForecast1-Feb-23$4,830

With filter

lbendlin_0-1710038183100.png

Without filter

lbendlin_1-1710038204058.png

 

 

BuildingBusiness AreaAccount_KeyAccountExercise TypeMonthValue
Office Building 4CorporateAccount_Generator MaintenanceGenerator MaintenanceBudget1-Jan-23$0
Office Building 4CorporateAccount_LandscapingLandscapingBudget1-Jan-23$0
Office Building 4CorporateAccount_Snow RemovalSnow RemovalBudget1-Jan-23$0
Office Building 4CorporateAccount_Multimedia AV RepairsMultimedia AV RepairsBudget1-Jan-23$0
Office Building 4CorporateAccount_Misc R&MMisc R&MBudget1-Jan-23$16,687
Office Building 4CorporateAccount_Building/Ground MaintenanceBuilding/Ground MaintenanceBudget1-Jan-23$1,663
Office Building 4CorporateAccount_Electrical WorkElectrical WorkBudget1-Jan-23$2,345
Office Building 4CorporateAccount_Elevator MaintenanceElevator MaintenanceBudget1-Jan-23$835
Office Building 4CorporateAccount_Equipment Repairs & MaintEquipment Repairs & MaintBudget1-Jan-23$795
Office Building 4CorporateAccount_Furniture/Cubicle RefurbishFurniture/Cubicle RefurbishBudget1-Jan-23$500
Office Building 4CorporateAccount_HVAC MaintenanceHVAC MaintenanceBudget1-Jan-23$14,569
Office Building 4CorporateAccount_Janitorial ServicesJanitorial ServicesBudget1-Jan-23$31,378
Office Building 4CorporateAccount_Parking Lot MaintenanceParking Lot MaintenanceBudget1-Jan-23$410
Office Building 4CorporateAccount_Plumbing WorkPlumbing WorkBudget1-Jan-23$232
Office Building 4CorporateAccount_Window CleaningWindow CleaningBudget1-Jan-23$1,232
Office Building 4CorporateAccount_Furniture/Cube Moves/InstallationsFurniture/Cube Moves/InstallationsBudget1-Jan-23$7,913
Office Building 4CorporateAccount_Copier/Fax PaperCopier/Fax PaperBudget1-Jan-23$650
Office Building 4CorporateAccount_Housekeeping SuppliesHousekeeping SuppliesBudget1-Jan-23$2,351
Office Building 4CorporateAccount_Document DestructionDocument DestructionBudget1-Jan-23$725
Office Building 4CorporateAccount_ElectricElectricBudget1-Jan-23$12,649

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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