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 ,
Just wanted to check if you had the opportunity to review the suggestion provided?
If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank You