Forum Discussion
How to sum a column when pulling data from semantic model?
- 1 year ago
Hi Anonymous ,
If you're working in Power BI Desktop and pulling data from a semantic model (such as a published dataset or Analysis Services), then your ability to write DAX measures depends on whether you're allowed to extend the model. If you're in a pure live connection mode, Power BI won’t let you create new measures unless you're using DirectQuery for Power BI datasets (composite models). If that’s enabled, click “Make changes to this model” when prompted, and you’ll be able to create a new measure.
To create a DAX measure that sums the [Widgets] column, you can write:
Total Widgets = SUM('YourTableName'[Widgets])Replace 'YourTableName' with the actual name of your table in the model. If [Widgets] is already a measure and not a raw column, don’t try to wrap it in SUM() again—just use it directly. If your model doesn’t support adding measures, you won’t see the option to create one, and you’ll need to enable composite model mode via File > Options > Preview features > DirectQuery for Power BI datasets and restart Power BI. Once done, you can add your own measures and use them in visuals like any other field.
Best regards,
Hi Anonymous ,
Since I didnt hear back from you I am assuming you are still facing the issue.
I would encourage you check the data type-
Make sure [widgets] is a numeric column. If it’s text, sum() will not work.
If thats already a numeric field, and still you encounter an error, can you share more information about the issue like-the error details, data source, type of connection?
So that it we be easy for us to resolve the issue.
Thank You
If this post helps, please give us Kudos and consider marking it Accept as solution to assist other members in finding it more easily.