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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Amerv
Regular Visitor

Apply condition (For loop) from big data-set to create something similar to below.

I have a large dataset, and I need help to create something similar to show as the above where v99 to v 135 as rows ( where the condition == Yes), the first screenshot is showing the data with random names it. what I want to achieve is the screenshot below where. I tried this in Python and it is worked I want to do the same in Power bi . I hope that is help explain the issue.

 

raw data

Exp2 .PNG

 

The end result should be like that ( where v1 = Geo , and V2 = countries) 

EXP1.PNG

exp 3 python.PNG

1 REPLY 1
sturlaws
Resident Rockstar
Resident Rockstar

Hi, @Amerv

 

Have you considered the Power BI Python-visual. Be sure to check out the limitations though, if you dataset has more than 150.000 rows it will not work properly.

 

I also think DAX and Power BI will be able to solve this for you. First use power query(edit query) to pivot the table so that you get one row for each column name(you can call this column V). Then create a measure like this:
number of rows with yes = calculate(countrows(dataset);filter(dataset;valueColumn="yes").

Then add a matrix-visual to the canvas and add countries on the column-axis and V on the row-axis.
If you upload a small sample dataset, I can show you have to do it.

cheers,

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.