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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Calculation for Unstructured data.

Dear all,

This data involves a lot of formula calculations, but all of these calculations are not structured. The calculation of this data is NOT STRUCTURED; it doesn't follow the order. The calculation in Power BI are structurally built on and follow the order(from sub to main sub).

 

How can I create a calculated measure that focuses specifically on certain "BLOK"? I understand that my explanation might be confusing, as the data itself has caused a lot of confusion for me.

 

As you can see in the picture, for the data labeled 1&2 (ex: Sawah sempadan) should have different answer for the BLOCK (not 9.12), because the formula calculation is diffrent.

I need a guide here, please blok skim.png

1 REPLY 1
Mahesh0016
Super User
Super User

@Anonymous I hope this helps you. Thank You.

It seems like you are working with data in Power BI and want to create a calculated measure that focuses on specific "BLOK" values, where the calculation is not structured and varies for different "BLOK" values. If I understand correctly, you want to apply different calculations based on the "BLOK" values.

Here are the general steps to create a calculated measure in Power BI for this scenario:

1. **Identify the Calculation Logic:** You mentioned that the calculation varies for different "BLOK" values. You need to specify the logic or formulas for each "BLOK" value separately. You might need to use conditional statements to apply different calculations based on the "BLOK" value.

2. **Create a Measure:** In Power BI, you can create calculated measures using the DAX (Data Analysis Expressions) language. To create a measure, go to the "Modeling" tab in the Power BI Desktop and select "New Measure."

3. **Write DAX Code:** In the DAX formula bar, you can write the DAX code for your calculated measure. You will need to use DAX functions and conditional statements to implement the different calculations for different "BLOK" values.

Here's a simplified example in DAX to illustrate the concept:


Custom Measure =
SWITCH(
MAX('YourTable'[BLOK]),
"1&2", SUM('YourTable'[Value]) * 2, -- Custom calculation for BLOK "1&2"
"AnotherBLOK", SUM('YourTable'[Value]) * 3, -- Custom calculation for another BLOK
// Add more cases for other BLOK values as needed
SUM('YourTable'[Value]) -- Default calculation if BLOK doesn't match any case
)

In the above example, we are using the `SWITCH` function to evaluate the "BLOK" value and apply different calculations based on the cases you define.

4. **Test and Validate:** After creating the measure, make sure to test it with your data to ensure that it produces the expected results for different "BLOK" values.

5. **Use the Measure in Visuals:** Once you have created and validated the measure, you can use it in your Power BI visuals to display the calculated values for the specified "BLOK."

Remember to replace `'YourTable'`, `'BLOK'`, `'Value'`, and the calculation logic in the DAX code with your actual table and column names and the appropriate calculation formulas.

If you have a more specific example or need help with the actual DAX code based on your data and calculation requirements, please provide more details, and I can assist you further.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.