Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hello,
I am quite confusing why my DAX cannot recognize some columns when I have the conditional calculation formula among four three tables.
Table "ItemCard" include column [Item No] from 1 to 30, column [Category] include "Set" and "CAL",column [Lead time] as numbers,
Table "ItemLedgerEntries" include column [Item No] from 1 to 30, column [qty], measure [avgDailyConsumptionQty]
Table "SetToOrder" include column [Item No] from1 to 10, column [SafetyStockQty], column [Category] all is "Set",
Now I want to write the DAX to enable me know all the item Safety Stock Qty so I can know when shall I place new order for the items.
Logic:
SafetyQty =
IF(ItemCard[Category]="Set",
SetToOrder[SafetyStockQty],
ItemCard[LeadTime]*ItemLedgerEntries[AvgDailyConsumptionQty]*1.8))
I don't know why for some reason, the system prompt my DAX logic is wrong. Power BI desktop cannot execujte this DAX.
Can anyone offer some suggestions?
Thank you!
Solved! Go to Solution.
@Shineccx007
Please check the attached file and see if this is your requirement.
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@Shineccx007
Have you created the relationships between the tables, pleas share a screenshot of it. In which table you want the new calucalted column to calculate the Safty Stock?
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Hi Fowmy,
Relationship among these tables:
The key is item No
ItemCard is linked by [item no] to ItemLedgerEntries, one to many
ItemCard is linked by [item no] to SetToOrder, one to one
I wanted to add the calculated column under ItemCard table on the SafetyStock Calculation
Thanks!
@Shineccx007
I am not sure the following will work as I need to know how your measure [AvgDailyConsumptionQty] is calculated.
Please try:
SafetyQty =
IF (
ItemCard[Category] = "Set",
RELATED ( SetToOrder[SafetyStockQty] ),
ItemCard[LeadTime] * [AvgDailyConsumptionQty] * 1.8
)
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Thank you Fowny!
My original dataset, under ItemCard, the column [lead time] is missing some data there. I write the dax below, let the system calculate the one with value only. But I have no idea why it kept showing blank in my measurement. Screenshot as below.
Hi Fowemy @Fowmy
It showed "Expressions that yield variant data-type cannot be used to define calculated columns."
Avg Daily consumption column under table ItemLedgerEntries is calculated by summarize recent 3 month consumption quantity and divide by 20.
I have a seperate date table "dim_date", it's a calendar from min.ItemLedgerEntries[PostingDate] till today, linked by date to ItemLedgerEntries.
Model as below:
@Shineccx007
Looks like i meed to have a look at your model.
Sharing a dummy Power BI file representing your scenario would be beneficial. You can save the Power BI file on Google Drive or any other cloud storage platform and provide the link here. Kindly ensure that permission is granted to open the file.
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Here is the dataset I modified. Please have a look at it.
Thank you so much!
https://drive.google.com/file/d/1V_bO2Zj5eF-zT4CkTa7o1FV3m9pFxcBb/view?usp=sharing
Here is the link on the file. I modified the dataset a little bit.
https://drive.google.com/file/d/1baq1qiV36AaJqAQnVIFNA4gsO4yVJP8v/view?usp=sharing
@Shineccx007
Please check the attached file and see if this is your requirement.
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
15 | |
11 | |
8 | |
8 | |
8 |
User | Count |
---|---|
22 | |
13 | |
11 | |
10 | |
10 |