Power BI DAX: Add Text Status to Records with Calculated Column
A calculated column is a column that you add to a table in a data model that is based on a DAX formula that you define. Calculated columns are calculated during the data refresh and the results are stored in the column for use in later operations.
In this video, we use a calculated column by DAX SWITCH function to add a text string status to each record in a fact table. This status are used to categorize the records into different groups, which then be used to create visualizations.
The DAX formula to create the calculated column for status in the video is:
Blood Pressure Status =
SWITCH(
TRUE(),
[Systolic BP]>=[Systolic_Max] || [Diastolic BP]>=[Diastolic_Max], "Hypertension",
([Systolic BP]<[Systolic_Max] && [Systolic BP]>[Systolic_Min])
&& ([Diastolic BP]<[Diastolic_Max] && [Diastolic BP]>[Diastolic_Min]),"Normal",
[Systolic BP]<=[Systolic_Min] || [Diastolic BP]<=[Diastolic_Min], "Low BP "
)
Using DAX calculated columns to add string status to each record in a fact table is a great way to categorize the data and create meaningful visualizations. But we are not limited us by only calculated column. We may also adopt DAX calculated measure state the status of aggregated value, and colour the title and label in visual. In next video The further developed approach will be introduced. expect you come back to watch it when it is published in the channel. Thank you for watching. I hope you found this tutorial helpful.
If you want to get more info regrading BI , Analytics and Automations please visit
https://www.youtube.com/channel/UCj-aR1f7kzIXYIioh756p0Q
Comments
Post a Comment